More precisely, a value
in a computer program
that is guaranteed to have a named location
or in a register
) by the language definition
. Originally the name "lvalue" came from it being something that made sense on the LHS
of an assignment statement
(and obviously said LHS must have some named location, or we cannot assign
to it, or cannot ever find the assigned value again).
However, the distinction is (somewhat) important. C and (to a much great extent) C++ have a concept of constant lvalue! Naturally, it never makes sense to have a constant on the LHS of an assignment statement. But a statement like
const double pi = 4*atan(1.0); does create an lvalue! We can say
&pi to get a pointer (of type
const double *).
It seems like the operative definition of an lvalue in C and C++ is "anything to which the address-of operator
& may be applied". Of course, this still doesn't deal with overloading
operator&() in C++; it might be better to think of an lvalue there as anything that may be passed by reference.
By contrast, you cannot take the address even of as simple an expression as
2*pi*r. So it's not an lvalue. And, of course, there's no reason for it to have a named location.