从4.1 / 2
The value contained in the object indicated by the lvalue is the
rvalue result. When an lvalue-to-rvalue conversion occurs within the
operand of sizeof (5.3.3) the value contained in the referenced object
is not accessed,since that operator does not evaluate its operand.
出于好奇,我想知道,同样适用于if,for,while语句,即当评估语句的结果时,左值是否转换为右值?
解决方法
是.没有左值到右值的转换,它无法读取它的值.
简而言之,将左值作为某种容器,将rvalue视为容器中包含的值.
C 03,第3.10 / 7节,
Whenever an lvalue appears in a context where an rvalue is expected,the lvalue is converted to an rvalue; see 4.1,4.2,and 4.3.
请阅读§4.1/ 2(您的报价),
The value contained in the object indicated by the lvalue is the rvalue result.
相关主题:
> What standard clause mandates this lvalue-to-rvalue conversion?