Search code examples
cwinapiunicodewchar-t

wchar_t is unsigned or signed


In this link unsigned wchar_t is typedefed as WCHAR. But I cant find this kind of typedef in my SDK winnt.h or mingw winnt.h.

wchar_t is signed or unsigned?

I am using WINAPIs in C language.


Solution

  • The signedness of wchar_t is unspecified. The standard only says (3.9.1/5):

    Type wchar_t shall have the same size, signedness, and alignment requirements (3.11) as one of the other integral types, called its underlying type.

    (By contrast, the types char16_t and char32_t are expressly unsigned.)