On 6/22/06, Andrew Talbot Andrew.Talbot@talbotville.com 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?
To be as portable as possible, we code to the lowest common denominator. Not all compilers support L"". We adhere to C89, but I can't remember what it says about L"", if anything. The point is that WCHAR blah[] ={...} will work for every compiler.