Re: Legality of a++ = 1 ?
Russell Shaw <rjshawN_o@s_pam.netspace.net.au> writes:
> I read ISO/IEC 9899:201x, section 22.214.171.124 Postfix increment and
> decrement operators.
> Why couldn't the semantics of this be: "a" is assigned "1", then
> "a" is incremented?
> gcc gives error: lvalue required as left operand of assignment
(a=1)++ may work.
If you don't like this, overload the operators "=" and "++" for
a, if that's an object of your class.
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591