Back to Top

宽字符到底是多少位

在VC下wchar_t下是2个字节,但在GCC下并非如此,默认是4个字节, 增加-fshort-wchar选项后为两个字节

The C and C++ standard libraries include a number of facilities for dealing with wide characters and strings composed of them. The wide characters are defined using datatype wchar_t, which in the original C90 standard was defined as “an integral type whose range of values can represent distinct codes for all members of the largest extended character set specified among the supported locales” (ISO 9899:1990§4.1.5)