Topic: Leapin' lvalues


Author: scott@Apple.COM (scott douglass)
Date: 17 Dec 90 21:39:45 GMT
Raw View
Why does the ARM (in section 5) allow some non-traditional
(w.r.t. ANSI-C) lvalues?

For instance the following statements are legal in C++, but not C:
    (++i) = 2;  // ARM 5.3.1
    (i += 3) = 5; // ARM 5.17

But the following is not:
    (i++) = 7;  // ARM 5.2.5

And the following are not explicitly specified:
    (-i) = 11;  // ARM 5.3
    (i + 13) = 17; // ARM 5.7

The usefulness of such constructs seems limited.  (My guess
is that the intent was to allow various user defined operator
overloadings to return lvalues.  This is not a good reason
since section 5 explicitly does not apply to overloaded
operators (the commentary even reiterates the point).)

Hopefully the standard will explicitly state the lvalue-ness
of all expressions.