On Thu, Jun 22, 2006 at 10:36:10PM +0100, Andrew Talbot wrote:
James Hawkins wrote:
Probably, L"" is not portable, and you have to use:
static const WHCAR string[] = {'s','t','r','i','n','g',0};
I'm just curious: not arguing, ;) but Plauger says, in "The Standard C Library" (1992, p. 219): "You write a wide character constant as, for example, L'x'. It has type wchar_t. You write a wide characer string literal as, for example, L"hello". It has type array of wchar_t. wchar_t is an integer type that can represent all the code values for all wide-character encodings supported by the implementation." Why might it not be portable?
In Linux, L"" makes 4 byte character strings (if not using explicit -fshort-wchar). Also, if the user then calls wc* functions from glibc, they will use 4 byte characters.
It is all to avoid confusion.
Ciao, Marcus