C++ 对字符文字的顺序有什么保证?
What guarantees does C++ make about the ordering of character literals?
C++ 对字符文字的顺序有什么保证? 基本源字符集中的字符有明确的顺序吗? (例如 'a' < 'z'
一定是真的吗?'A' < 'z'
怎么样?)
该标准仅提供对十进制数字 0
到 9
的排序的保证,来自草案 C++11 标准部分 2.3
[lex.charset]:
In both the source and execution basic character sets, the value of
each character after 0 in the above list of decimal digits shall be
one greater than the value of the previous.
否则说(强调我的):
The basic execution character set and the basic execution
wide-character set shall each contain all the members of the basic
source character set, plus control characters representing alert,
backspace, and carriage return, plus a null character (respectively,
null wide character), whose representation has all zero bits. For each
basic execution character set, the values of the members shall be
non-negative and distinct from one another.
注意,EBCDIC 有一个不连续的字符集。
C++ 对字符文字的顺序有什么保证? 基本源字符集中的字符有明确的顺序吗? (例如 'a' < 'z'
一定是真的吗?'A' < 'z'
怎么样?)
该标准仅提供对十进制数字 0
到 9
的排序的保证,来自草案 C++11 标准部分 2.3
[lex.charset]:
In both the source and execution basic character sets, the value of each character after 0 in the above list of decimal digits shall be one greater than the value of the previous.
否则说(强调我的):
The basic execution character set and the basic execution wide-character set shall each contain all the members of the basic source character set, plus control characters representing alert, backspace, and carriage return, plus a null character (respectively, null wide character), whose representation has all zero bits. For each basic execution character set, the values of the members shall be non-negative and distinct from one another.
注意,EBCDIC 有一个不连续的字符集。