Re: [ILUG] gcc & wcscasecmp() strangeness . . . .

From: Kevin O' Riordan (kor at domain compsoc.com)
Date: Wed 03 Jul 2002 - 09:44:52 IST


Hi John,

> Mornin all . . . . gcc seems to treat wcscasecmp() differently if it is
> behaving as a C++ compiler rather than a C compiler. With the below inside a

the manpage mentions that wcscasecmp() is a GNU extension. Out of
curiosity, I tried sticking a '#define _GNU_SOURCE' line at the top of
the .cpp file, and it compiled and ran fine. I wouldn't claim to know
/why/ it works, but it might help anyway.

blah
-kev

P.S. - I'm also using gcc2.96

On Prickle-Prickle, the 38th day of Confusion, John_White at domain dell.com declared:
> string.c and inside a string.cpp I get . . .
>
> /* begin */
> #include <wchar.h>
> #include <stdio.h>
>
> int main()
> {
> wchar_t String1[] = L"New";
> wchar_t String2[] = L"new";
>
> printf("%S == %S ? %d\n", String1, String2, (0 == wcscasecmp(String1,
> String2)));
>
> return(0);
> }
> /* end */
>
> [~/test $]cc -o string1 string.c
> [~/test $]cc -o string2 string.cpp
> cstring.cpp: In function `int main()':
> cstring.cpp:10: warning: implicit declaration of function `int
> wcscasecmp(...)'
> [~/test $]
>
> extern "C" { ... } in the appropriate place doesn't seem to help . . .
> Other wide char functions are fine . . . .
> Both resulting binaries seem to work fine . . . .
> This is using a very old compiler ( egcs-2.91.66 - RH6.0 ) but I don't
> have a more recent one to hand . . . do others see the same thing ?
>
> Any help very much appreciated.
> John.
>
>
>
> --
> Irish Linux Users' Group: ilug at domain linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at domain linux.ie

-- 
	Science is facts; just as houses are made of stones so
	is science made of facts; but a pile of stones is not a
	house, and a collection of facts is not necessarily a
	science
		-Henri Poincare


This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:39 GMT