size of wchar_t

Eljay Love-Jensen eljay@adobe.com
Thu Apr 1 13:26:00 GMT 2004


Hi Artem,

I've used this trick in the past:

g++ -c -DWCHAR_BIT_SIZE=32 foo.cpp

On some platforms it is 31 bit (sufficient for ISO 10646); but I use 32 
even in that case, thus I'm including the fallow bit.  WCHAR_MAX will be 
0x7FFFFFFFu on those platforms.

g++ -c -DWCHAR_BIT_SIZE=16 -fshort-wchar foo.cpp

I then use the WCHAR_BIT_SIZE to alter code behavior.  Absence of 
WCHAR_BIT_SIZE causes a #error.

HTH,
--Eljay



More information about the Gcc-help mailing list