Use: #if WCHAR_BITSIZE == 16 blah blah blah #elif WCHAR_BITSIZE == 32 blah blah blah #else #error Unsupported/unknown wchar_t bitsize. #endif
When you are compiling your code with 32-bit wchar_t: g++ -DWCHAR_BITSIZE=32 foo.cpp
When you are compiling your code with 16-bit wchar_t: g++ -DWCHAR_BITSIZE=16 foo.cpp
HTH, --Eljay