[英]What guarantees does C++ make about the ordering of character literals?
What guarantees does C++ make about the ordering of character literals? C ++对字符文字的排序有什么保证? Is there a definite ordering of characters in the basic source character set ?
基本源字符集中是否有明确的字符排序? (eg is
'a' < 'z'
guaranteed to be true? How about 'A' < 'z'
?) (例如
'a' < 'z'
保证是真的吗? 'A' < 'z'
怎么样?)
The standard only provides a guarantee for ordering of the decimal digits 0
to 9
, from the draft C++11 standard section 2.3
[lex.charset] : 该标准仅为草案C ++ 11标准第
2.3
节[lex.charset]提供了对十进制数字0
到9
排序的保证:
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.
在源和执行基本字符集中,上述十进制数字列表中0之后的每个字符的值应比前一个值大1。
and otherwise says ( emphasis mine ): 否则说( 强调我的 ):
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.
基本执行字符集和基本执行宽字符集应各自包含基本源字符集的所有成员,以及表示alert,backspace和回车符的控制字符,以及空字符(分别为null宽字符),其表示具有全零位。 For each basic execution character set, the values of the members shall be non-negative and distinct from one another .
对于每个基本执行字符集, 成员的值应是非负的并且彼此不同 。
Note, EBCDIC has a non-consecutive character set. 注意, EBCDIC具有非连续的字符集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.