Is wchar_t just a typedef of unsigned short?

Marlon picture Marlon · Mar 7, 2010 · Viewed 14.3k times · Source

for example, does:

wchar_t x;

translate to:

unsigned short x;

Answer

Artyom picture Artyom · Mar 7, 2010

In short: in C may be in C++ no.

Widely. C defines wchar_t as typedef but in Unix it is generally 4 bytes (so generally not short) and in Windows 2 so it may be short.

Under C++ it is unique built-in type like char or int, so you can legally overload void foo(short x) and void foo(wchar_t x)