Is wchar_t just a typedef of unsigned short?

前端 未结 6 670
滥情空心
滥情空心 2020-12-11 14:54

for example, does:

wchar_t x;

translate to:

unsigned short x;
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-11 15:18

    No, it doesn't. It translates to 'a wide character.' Making any assumptions about what that happens to be on a particular platform is incorrect, and defeats the entire purpose of having a wchar_t in the first place.

    The point of using an abstraction is to separate the semantic meaning of the type from its underlying representation.

提交回复
热议问题