What is the reasoning behind the naming of “lvalue” and “rvalue”?

前端 未结 6 840
清酒与你
清酒与你 2021-01-16 07:30

What is the reasoning behind the naming of \"lvalue\" and \"rvalue\" in C/C++ (I know how they function)?

6条回答
  •  礼貌的吻别
    2021-01-16 08:16

    This is the result of the simplification of a (somewhat more complex) concept.

    lvalues are left values, i. e. those which "can be on the left side of an assignment". This is, again, a simplification, not all lvalues can be directly assigned to as-is (for example, arrays can't, only elements of a non-const arrays, so subscripting is required).

    rvalues are right values, those which can only be on the right side of an assignment expression.

提交回复
热议问题