S
S.Tobias
In comp.lang.c Netocrat said:Right, my concept of lvalue was slightly out. Non-modifiable being for
example arrays and structs.
I'm not sure it's that simple with storage for lvalues. Take `register'
variables for an example, or pointers to objects whose lifetime has
finished (dereferencing such a pointer is an lvalue, whether
the object exists or not).
Consider also this example:
struct s { int a[1]; };
struct s f(void);
f().a[0] = 7; //UB
The expression on the left is clearly a modifiable lvalue.
But does it take any storage? I think C++ is more verbose about
temporaries; they can be optimized out, which is unspecified.
I don't think C even has an idea of a temporary.
OTOH, f().a decays into a pointer to its first element, therefore
the array the pointer points to must be an object, therefore it
must (temporarily) take some storage. Is that a right conclusion?