加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c – 左值转换的左值

发布时间:2020-12-16 03:44:21 所属栏目:百科 来源:网络整理
导读:从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 th
从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?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读