Are lvalues basically a normal variables and rvalues a temporary objects? Or there can also be different things that we can assume as rvalues or lvalues?
Asked
Active
Viewed 113 times
0
-
Basically yes. Anything with a name, and all reference types are lvalues. – NathanOliver May 19 '20 at 19:28
-
The "L" and "R" in the names derive (somewhat obscurely) from the fact that an *lvalue* can be the left-hand side of an assignment (so it must be something that has an address), whereas an *rvalue* can be the right-hand side (so it can be a constant, or an expression). In `a = b + c;`, `a` is an lvalue and `b + c` is an rvalue (one cannot, for example, have `b + c = a`). – Adrian Mole May 19 '20 at 19:33