From: Brian Foster (blf at domain utvinternet.ie)
Date: Wed 03 Jul 2002 - 16:44:49 IST
| Date: Wed, 3 Jul 2002 03:15:54 -0500
| From: John_White at domain dell.com
|
| Mornin all . . . . gcc seems to treat wcscasecmp() differently if it
| it is behaving as a C++ compiler rather than a C compiler. [ ... ]
it is treating them differently because the language requires
it --- C is not the same as C++. the declarations in <wchar.h>
are _not_ being seen in either case (I explain why below), but
in C, that means the function returns an `int' (implicit int).
in C++, it is illegal.
so why isn't the declaration being seen? as Kevin O' Riordan
pointed out, that function is a GNU extension, which apparently
is not enabled by default on your system (nor on mine or his).
and as Kevin said, enable it by defining `_GNU_SOURCE'. (make
sure you spell it properly; note the leading `_' --- which I
missed the first time! ;-( )
and why doesn't defining `__USE_GNU' work? well, first, you
shouldn't expect it to --- anything starting with `__' (two
or more(?) leading `__'s is "internal") and use by users may
lead to unexpected consequences. in this case, the reason is
because <features.h>, `#include'd by <wchar.h>, deliberately
`#undef's `__USE_GNU'. to enable it, define `_GNU_SOURCE';
see <features.h>.
I would not be too surprised to learn the relevant feature
names have changed over time, so you might be running into
a version incompatibility issue here. to debug the situation
on your system, study the outputs from `gcc -E':
gcc -E string.c >c
g++ -E string.cpp >cpp
gcc -E -D_GNU_SOURCE string.c >c-Dsource
g++ -E -D_GNU_SOURCE string.cpp >cpp-Dsource
gcc -E -D__USE_GNU string.c >c-Duse
g++ -E -D__USE_GNU string.cpp >cpp-Duse
cheers!
-blf-
--
Innovative, very experienced, Unix and | Brian Foster Dublin, Ireland
Chorus (embedded RTOS) kernel internals | e-mail: blf at domain utvinternet.ie
expert looking for a new position ... | mobile: (+353 or 0)86 854 9268
For a résumé, contact me, or see my website http://www.blf.utvinternet.ie
Stop E$$o (ExxonMobile): «Whatever you do, don't buy Esso --- they
don't give a damn about global warming.» http://www.stopesso.com
Supported by Greenpeace, Friends of the Earth, and numerous others...
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:40 GMT