l-value 和 r-value "左值"与"右值"

来源:互联网 发布:ai软件基础教程视频 编辑:程序博客网 时间:2024/05/22 03:29

先看msdn上的一句话:

Expressions that refer to memory locations are called "l-value" expressions. An l-value represents a storage region's "locator" value, or a "left" value, implying that it can appear on the left of the equal sign (=). L-values are often identifiers.

说 指向(refer to)一个内存区域的表达式被称为 "左值"(l-value)表达式.一个左值表现为一个存储区域的定位器值,或者一个"左"值,暗示着它能出现在赋值操作符(台湾译为赋值运算子)的左边.左值通常是标识符.


可见,我们常说的左值,l-value,l译为location可能更贴切,表示可在内存内寻址的值.

r-value,r译为read可能更贴切,表示可读的值.在内存内不可寻址(这里到底有没有地址我还真不知道.)

原创粉丝点击