According to the C++ standard, prefix ++
is an lvalue (which
is different than C), post-fix no. More generally, C++ takes
the point of view that anything which changes an lvalue
parameter, and has as its value the value of that parameter,
results in an lvalue. So ++ i
is an lvalue (since the
resulting value is the new value of i
), but i ++
is not
(since the resulting value is not the new value, but the old).
All of this, of course, for the built-in ++
operators. If you
overload, it depends on the signatures of your overloads (but
a correctly designed overloaded ++
will behave like the
built-in ones).
Of course, neither (++ i) = a;
nor (i ++) = a;
in your
example are legal; both use the value of an uninitialized
variable (i
), which is undefined behavior, and both modify i
twice without an intervening sequence point.