------- Additional Comments From d_picco at hotmail dot com 2005-02-23 20:24 ------- (In reply to comment #0) > Consider these situations: > > int a = 0; > int b = a++ + a++; > int c = (a++) + (a++); > int d = a++ + (a++); > int e = (a++) + a++; > > b == c == d == e == 0. I understand based on a previous bug about sequence > points in C++ but I think a common-sense approach takes precident here. If > 'a' > were a user-defined class with the operator++ (postfix), how could the user > mimic such behaviour, namely b == c == d == e == 0? In fact they couldn't. > The > proper solution is then to have b == c == d == e == 1.
I should have clarified this more: Consider these situations: Case 1 ====== int a = 0; int b = a++ + a++ Case 2 ====== int a = 0; int c = (a++) + a++; Case 3 ====== ... etc Otherwise b != c != d != e if the situations were read sequentially -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20181