Tuesday, 16 April 2013

Keeping Pace with the New C++ and the Expanding Lexicon of Lvalues

Reading the "Standards committee" papers is one way (open-std.org) to keep in touch. The latest draft standard can be found in pdf format here.

One example of how things change is the new nomenclature of lvalues and rvalues.

In TCPL, an lvalue is simply "something on the left-hand-side of an assignment".

In C++0x, semantics change.

A glvalue is now a "generalised lvalue" denoted either an "lvalue" or an "xvalue".

An lvalue now means a function or an object, and an xvalue is an object near the end of its lifetime (short for "eXpiring Value").

An "rvalue" now means, more precisely, an xvalue, a temporary object (or sub-object of the same such) or a value not associated with an object.

A "prvalue" is an "rvalue" that is not an "xvalue".

No comments: