Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is wchar_t just a typedef of unsigned short?

Tags:

for example, does:

wchar_t x;

translate to:

unsigned short x;
like image 597
Marlon Avatar asked Mar 07 '10 07:03

Marlon


1 Answers

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)

like image 79
Artyom Avatar answered Sep 27 '22 16:09

Artyom