This project is read-only.

wchar_t variable initialization to wchar_t literal

Apr 26, 2014 at 3:40 PM
Hi everyone,

I am bit confused with this wchar_t initialization:
#include <vcc.h>

int main() {
    wchar_t x = L'A'; /* VC0037 */

    return 0;
}
It makes this error output:
init.c(4,15) : error VC0037: Cannot implicitly convert type 'wchar' to 'unsigned __int16'.
Exiting with 3 (1 error(s).)
I do not really understand why variable, declared as wchar_t, is considered to be uint16 by VCC, when the wchar_t type obviously exists. Visual C++ compiler has option /Zc:wchar_t- that sets wchat_t as unsigned short int. Is this the case? I have read discussion https://vcc.codeplex.com/discussions/63106 where the error VC0037 is mentioned, but it gave me no answer. Has someone an idea?

David