This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: stddef.h, [C++] wchar_t vs size_t
- To: Benjamin Kosnik <bkoz at redhat dot com>
- Subject: Re: stddef.h, [C++] wchar_t vs size_t
- From: brent verner <brent at rcfile dot org>
- Date: Mon, 9 Oct 2000 05:42:01 -0400
- Cc: gcc at gcc dot gnu dot org, jason at cygnus dot com
- References: <200010090831.e998VPn13947@fillmore.constant.com>
On 09 Oct 2000 at 01:31 (-0700), Benjamin Kosnik wrote:
|
| What's up with the wchar_t type definition when using the c++ compiler?
|
| ginclude/stddef.h has typedefs for
|
| typedef __SIZE_TYPE__ size_t;
| typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
| yet
|
| #ifndef __cplusplus
| typedef __WCHAR_TYPE__ wchar_t;
| #endif
|
| Can somebody please explain why this is so? Why should wchar_t be a
| special case? This contradicts ISO/IEC 9899:1999 (E), in particular:
just guessing... wchar_t is a keyword in c++, not a user-defined type,
thus: [quoting ISO 14882]
21 Strings library
...
3 None of the headers shall define the type wchar_t (2.11).
| 7.17 Common definitions <stddef.h>
wish I had a copy of that to peruse :\
| This oddity is making it hard/difficult/impossible to correctly deal with
| c/c++ namespace issues.
yes it is :)
| If I comment out the ginclude/stddef.h oddnes, I get this:
|
| /mnt/hd/bliss/src.gcc/libstdc++-v3/include/c_std/bits/std_cstddef.h:76: conflicting
| types for `typedef long int wchar_t'
| <internal>:76: previous declaration as `typedef __wchar_t wchar_t'
| /mnt/hd/bliss/src.gcc/libstdc++-v3/include/c_std/bits/std_cstddef.h:76: using
| directive `wchar_t' introduced ambiguous type `__wchar_t'
| make[3]: *** [complex.lo] Error 1
| make[3]: Leaving directory `/mnt/hd/ahimsa/bld-x86-gcc-3-c_std/i686-pc-linux-gnu/libstdc++-v3/src'
| make[2]: *** [all-recursive] Error 1
this goes back to the whole reason I'm pretending to be a gcc-hacker...
cc1plus is doing the Wrong Thing with builtins of any type (AFAICS).
If you send me a minimal test case, I can get it to compile, as I have
a g++ that was handling all but redefining (overloading) builtin types.
for more info on this issue, see:
http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00155.html
(I have some _really_ nasty hacks in my personal tree that
gave good results wrt building libstdc++-v3 w/-fbuiltin,
and I'd like to see if those hacks fix your case as well.)
hth.
brent
--
All opinions expressed are My own, unless otherwise attributed. In
presenting facts, I expressly reserve the right to be Wrong. Portions
of this message authored by Me are subject to the Free Thought License.