Much ado about undefined statements
I am currently involved in a HUGE discussion focused around statements like :
OR
OR
Code:
c = a++ + a-- + ++a;
.. and you get the idea.
Anyone who knows something about sequence points will be able to answer this question really well.
Further more, on page 79 of 550 of http://www.open-std.org/JTC1/SC22/WG...docs/n1124.pdf, we have something very similar mentioned by way of
being undefined.
I would like some good authority to assert that expressions I highlighted at the beginning are undefined (compiler dependent ?) too..
From the preliminary searching I did, I saw "rules" like :
1. The outcome is still undefined because according to the Standard, altering a modifiable lvalue more than once before a sequence point is reached causes undefined behaviour.
2. Modifying the same variable using auto-increment/decrement more than once in the same statement gives undefined behaviour.
Can someone give better explanation which go more deep into the standard ?
I am also lookinf forward to a nice explanation on sequence points.
I went through :
http://en.wikipedia.org/wiki/Sequence_point
and found it good. Anyone has anything more/better to add or say ?