From: sowmya satyanarayana (firstname.lastname@example.org)
Date: Mon Nov 22 2010 - 02:14:20 CST
I have unicode C application. I am using the following macro to define my string
to 2 byte width characters.
#define _T(x) L##x
But I see that GCC compiler maps 'L' to wchar_t, which is 4 byte on Linux. I
have used -fshort-wchar option
on Linux but I want my application to be portable on AIX as well, which does not
have this option. I am not able
to findbest way to define _T(x) of UNICODE version, which takes 2 byte wide
I got the following explanation about wchar_t from The Unicode Standard, Version
4.0, issued by the Unicode
Consortiumand published by Addison-Wesley.
"The width of wchar_t is compiler-specific and can be as small as 8 bits.
programs that need to be portable across any C or C++ compiler should not use
for storing Unicode text. The wchar_t type is intended for storing
characters, which may be Unicode characters in some compilers. However,
who want a UTF-16 implementation can use a macro or typedef (for example,
that can be compiled as unsigned short or wchar_t depending on the target
Taking this, what is the best way to define _T(x) macro of UNICODE version, so
that my strings will always be
2 byte wide character?
Thanks in Advance.
This archive was generated by hypermail 2.1.5 : Mon Nov 22 2010 - 11:04:02 CST