I have started studying about C++0x. I came across the follow expression somewhere:
int l = 1, m=2;
++l *= m;
I have no idea whether the se
The expression is well defined in C++0x. A very Standardese quoting FAQ is given by Prasoon here.
I'm not convinced that such a high ratio of (literal Standards quotes : explanatory text) is preferable, so I'm giving an additional small explanation: Remember that ++L
is equivalent to L += 1
, and that the value computation of that expression is sequenced after the increment of L
. And in a *= b
, value computation of expression a
is sequenced before assignment of the multiplication result into a
.
What side effects do you have?
Both side-effects are transitively sequenced by the above two sequenced after and sequenced before.