Hi,

i just played around a little with wchar_t. I am not sure, but i think i got a warning that did not make any sense at all. Here's the small test:

#include <stdio.h>
#include <wchar.h>
#include <locale.h>

int
main (void)
{
   wchar_t a = L'©';      /* The copyright sign */

   setlocale (LC_ALL, "");
   printf ("char was %lc\n", a);

   return 0;
}

if i compile this with my gcc (GCC) 3.3.4 (pre 3.3.5 20040809) i got the following warning:

warning: character constant too long for its type

well, my linux uses UTF-8 and i know that the copyright sign is a 2byte multibyte. But if i use it with a wchar_t and the L modifier, i thought the compiler would change this multibyte to a correct 32bit unicode value? Well, at least the program works as expected. It prints the copyright sign.

Best regards
   Georg Steffers

Attachment: pgpzTEmm2hgHV.pgp
Description: PGP signature

Reply via email to