分类:
2008-11-14 10:35:45
wchar_t是ISO C/ANSI C的标准中的类型,他并没有定义其宽度,而留给具体的实现。在
windows下,为16bit,在unix like下为32bits。因此他并不具有portable特性,在不同环境下不一样,因此如果你想让你的程序具有可移植性,建议不要用wchar_t来存储你要存储的数据。
Wide character is a computer programming term. It is a vague term used to represent a that is richer than the traditional (8-bit) characters. It is not the same thing as .
wchar_t
is a data type in ANSI/ISO and some other that is intended to represent wide characters.
The standard 4.0 says that
and that
wchar_t
is compiler-specific and can be
as small as 8 bits. Consequently, programs that need to be portable
across any C or C++ compiler should not use wchar_t
for storing Unicode text. The wchar_t
type is intended for storing compiler-defined wide characters, which may be Unicode characters in some compilers."Under , wchar_t
is 16 bits wide and represents a code unit. On -like systems wchar_t
is commonly 32 bits wide and represents a code unit.
In ,