c wide chars
Colin (478) 2433 posts |
I’m having an unlucky streak at the moment I’ve found this bug with the c compiler (5.70) wchar_t* str = L"Hello"; printf(“%ls\n”,str); doesn’t print out “Hello”. From the disassembly Hello is correctly stored as 4 byte wchar_ts. The compiler doesn’t fault str being a wchar_t* – as it does if I just use %s. If I make str a normal char* (and remove the L from in front of Hello) I get a warning from the compiler and it prints Hello if I ignore the warning. |
Colin (478) 2433 posts |
This is probably related to one of the C99 non-compliances mentioned on page 80 of the C,C++ book. Assuming of course that the manual is kept up to date. ‘Wide character library support (using wchar.h and wctype.h header files)’ Though I was using neither header. |