This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

stddef.h, [C++] wchar_t vs size_t



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:

7.17 Common definitions <stddef.h>



This oddity is making it hard/difficult/impossible to correctly deal with
c/c++ namespace issues. 

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

?? 

-benjamin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]