Programmers who transition from VC6.0 to VS2013 should be confused about the way characters behave, often using _t ("") to display characters as they wish.
In fact _t ("") is a macro that acts as a compatible function that enables the compiler to compile strings in the default Character set form (ANSI or Unicode).
In VC2013 's Tchar.h file, I extracted some of the code, as follows:
This part of the code is very intuitive, when the Unicode character set is used, the compiler compiles the strings in _t ("") into Unicode form, and when the ANSI character set is used, the compiler compiles the strings in _t ("") into ANSI form.
Again, the character set.
Two character sets, Unicode and ANSI, are used under Windows. In the current Windows environment, the Unicode character set is stored in double-byte form, and ANSI is stored as a single byte (that is, 8-bit char).
As far as I know, the VC6.0 compiler uses the ANSI character set by default, and the Unicode character set is used by default when VS2010 or which version begins.
As for why there is a Unicode character set, mainly because the 8-bit ANSI character set can represent a maximum of 256 characters, only to meet the requirements of a very small number of areas, such as Britain and America, such as China, Chinese characters + symbols, a lot, 256 characters is far enough.
It is worth mentioning that characters in Unicode form are actually stored in small ends. Not much to say, see the code:
Operation Result:
VS2013 also does not support char16_t (C++11)! This code is compiled and run on http://cpp.sh/, which is very powerful and supports the new features of C + + very well.
Explore VC _t (""), found that: double-byte character/multibyte character is stored in the small end (at least in the VC2013 environment)