In order to find out what happened at the expression "i++ + i++ + i++ + i++", I wrote a test program as below.
compile it with g++ 4.6.3 and running this program under Ubuntu 12.04, the result are:
construct 3 construct 7 construct 12 construct 18 construct novalue call i++ for 18 call i++ for 12 call i++ for 7 call i++ for 3 call + for 3 and 7 call + for 10 and 12 call + for 22 and 18 i1++ + i2++ + i3++ + i4++ : 4 8 13 19 40 construct 3 call i++ for 3 call i++ for 4 call i++ for 5 call i++ for 6 call + for 6 and 5 call + for 11 and 4 call + for 15 and 3 i++ + i++ + i++ + i++ : 7 18 x 7 xx 12
with the contrast of the results from test case one and two using Int
type i defined, i predicted that the test case three should print x 7 xx 18
, but it didn't.
my question is how to explain the result?