wchar_t is unsigned or signed

The standard may not specify whether wchar_t is signed or unsigned, but Microsoft does. Even if your non-Microsoft compiler disagrees, the Windows API will be using this definition from /Zc:wchar_t (wchar_t Is Native Type):

Microsoft implements wchar_t as a two-byte unsigned value. It maps to the Microsoft-specific native type __wchar_t.


Be aware the type will vary in length by platform.

Windows uses UTF-16 and a wchar_t is 2 bytes. Linux uses a 4 byte wchar_t.


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.)