3.10 Lvalues and rvalues
1 Each expression is either an lvalue or rvalue value.
2 The value l refers to an object or function. Some value of the expression — class classes or cvqualified class type — also refers to objects. 47)
3 [Note: some built-in operators and function calls give lvalues. [Example: if E is an expression type of a pointer, then * E is the value of an lvalue expression relating to the object or function that E. points to. Like another For example, the function int & F (); profitability is an lvalue, so calling f () is an lvalue expression. ]
- [Note: some builin operators expect lvalue operands. [Example: built-in assignment operators expect left operands to be lvalues. ] Other built-in operators give r values, and some expect them. [Example: unary and binary + arguments and rvalue value Results. ] The discussion of each built-in operator in clause 5 indicates whether it expects lvalue operands and whether it has lvalue value. ]
5 The result of calling a function that does not return a link is an Rvalue. User-defined function operators and whether such operators calculate or give lvalues by their parameter and return types.
6 An expression that contains a temporary object resulting in a type without a reference is an rvalue (this includes explicitly creating an object using functional notation (5.2.3)).
7 Whenever an lvalue appears in the context where an r value is expected, the lvalue is converted to an rvalue; see 4.1, 4.2 and 4.3.
8 The discussion of the initialization reference in 8.5.3 and the temporary data in 12.2 indicate the behavior of lvalues and rvalues in other significant contexts.
9 Class values may have cvqualified types; nonclass rvalues always have cvunqualified types. Values should always have full types or void type; in addition to these types, lvalues can also be incomplete types.
10 The value of l for an object is necessary for changing, except that the value of the class type can also be used to change its referent under certain circumstances. [Example: a member function called for an object (9.3) can modify an object. ]
11 Functions cannot be changed, but function pointers can be modifiable.
12 A pointer to an incomplete type may be modifiable. At some point in the program, when the specified type is a complete object, at which pointer points can also be changed.
13 The referent should not change the expression (through this expression), except that if it has a class type and has a mutable component, this component can (7.1.5.1).
14 If an expression can be used to change the object to which it refers, the expression is called modifiable. A program that attempts to modify an object through an unmodifiable value lvalue or an rvalue expression is unformatted.
15 If a program tries to access the stored value of an object via l value other than one of the following types of behavior undefined48): - a dynamic type of an object, - a cvqualified version of a dynamic type of an object, - a type that is a signed or unsigned type corresponding to a dynamic type of an object , - a type that is a signed or unsigned type to a cvqualified version of a dynamic object type, - an aggregate or a union type that includes one of the above types among its members (including, recursively, a member of a subgroup and whether it contains a union), - a type that (possibly cvqualified) the base class type is a dynamic object type, - a char or unsigned char.