我想你正在读你的自己的消息到那个报价中。
An object that is declared const is guaranteed to remain constant for its lifetime, not throughout the entire execution of the program. For this reason, a const object cannot be used in constant expressions.
这第二句是说,没有const对象在常量表达式允许的,根本就没有,
它的原因是在第一个句子给出的,而我们可以预见哪里会可能使用const对象这样的情况下,在没有办法改变了明确的第二句话。
与学前禁止所有的狗没什么不同,因为更积极的可能会咬孩子。
C标准规定了这种行为,所以它不是真的应该对付IBM。他们的文件可能是模糊的(在一些读数),但他们是做正确的事情。
在(C99)6.8.4.2 The switch statement /3,我们看到:
The expression of each case label shall be an integer constant expression and no two of the case constant expressions in the same switch statement shall have the same value after conversion.
而在这同一标准的6.6 Constant expressions /6,它定义整型常量表达式这样的:
An integer constant expression shall have integer type and shall only have operands that are integer constants, enumeration constants, character constants, sizeof expressions whose results are integer constants, and floating constants that are the immediate operands of casts. Cast operators in an integer constant expression shall only convert arithmetic types to integer types, except as part of an operand to the sizeof operator.
正如你所看到的,也没有提及的const变量。