James Hawkins wrote:
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.
From what I can tell, L"" is good in C89 (although the result of
concatenating a wide string and a narrow string is undefined). However, the width of wchar_t is implementation-dependent, and may have a width anywhere between that of char and unsigned long (though, in practice, it is likely to be a synonym for an integer type that has at least a 16-bit representation, such as short or unsigned short). Whereas WCHAR is set to have a width of sixteen bits. So I think this is why the L-prefix form is not portable.
Thanks for helping me down this road of discovery.
-- Andy.