On different resources I found different definitions of rvalue , lvalue . How correct?

right value or read value ?

left value or locator value ?

  • Right left and right - nick_n_a
  • one
    It is not correct at all, it is not deciphered. But it came from right and left. - ixSci
  • In my opinion, the correct first option is, for example, take a simple expression: a = b + c, where (a = lvalue), a (b + c = rvalue). Judging by the example, lvalue implies a kind of left, but not a read, the same can be said about rvalue. - VladimirBalun
  • What is the question at all? Why is the heading talking about "rvalue and lvalue references ", and in the body of the question there is not a word about references and it's just about rvalue and lvalue? As the "accepted" the answer is chosen, which has no relation to the "rvalue and lvalue references" at all. What a meaningless mess? - AnT 2:32 pm
  • one
    @Dima Khodan: No. The main criterion for the quality of questions (and answers) to SO are their usefulness for subsequent readers. If the title of the question does not correspond to its content in any way, then the value of the question is “below the plinth” and it should be edited or deleted. Your "everyone here perfectly understood the essence" does not matter. I repeat once again: why is the title referring to " references "? If your question has no relation to the "references", then - correct the title. - AnT 9:39 pm

2 answers 2

Initially, it was about the left and right sides relative to the assignment operator. But the correct version of such a simple decoding is not and can not be. The terms will remain rvalue and lvalue . But what is the meaning embedded in them clearly spelled out in the standard . All this forms categories of expressions.

expression hierarchy

  • glvalue

    An expression whose calculation determines the essence of an object, bit field, or function.

  • prvalue

    An expression whose calculation initializes the object, a bit field, or calculates the value of the operand operator, according to the context of use.

  • xvalue

    This is a glvalue , which denotes an object or bit field whose resources can be reused (usually because they are near the end of their lifetime).

  • lvalue

    This is a glvalue , which is not xvalue .

  • rvalue

    This is a prvalue or xvalue .

Thus, any expression is primarily lvalue , xvalue, or prvalue . rvalue is already a generalization.

  • Oh, everything is complicated in the pros, but I understood the meaning and what you wanted to say. Thank. - raviga
  • Only a question like this. What does incomplete type mean? - raviga
  • one
    It A class that has been declared but not defined, an enumeration type in certain contexts (9.6), or an array of unknown bound or of incomplete element type, is an incompletely-defined object type. Incompletely-defined object types and cv void are incomplete types (6.7.1). Objects shall not be defined to have an incomplete type. A class that has been declared but not defined, an enumeration type in certain contexts (9.6), or an array of unknown bound or of incomplete element type, is an incompletely-defined object type. Incompletely-defined object types and cv void are incomplete types (6.7.1). Objects shall not be defined to have an incomplete type. - Croessmah

I do not know what you mean by the question "how correctly". rvalue and lvalue are categories of expressions. Here is what is written in the standard:

- A bit-field, or function.
This is where the statement will appear.
- An xvalue is a field that can be reused (usually).
- An lvalue is a glvalue that is not an xvalue.
- An rvalue is a prvalue or an xvalue.

// ...
[Note: Historically, lvalues ​​and rvalues ​​should be given the right side of the assignment (although this is no longer true); glvalues ​​are “generalized” lvalues, prvalues ​​are “pure” rvalues, and xvalues ​​are “eXpiring” lvalues. Despite their names, these terms classify expressions, not values. - end note]

  • 2
    Heh. And I was a little more confused by the translation :) - αλεχολυτ
  • @alexolut is great :) - Croessmah
  • Yeah. Someone even minus. Probably for mockery of the standard, which should be exclusively in English :) - αλεχολυτ
  • @alexolut it was Zuev. Joke. Or maybe not. )) - Croessmah