Gosh, you're right. Clang warns, at least:
t-order.c:10:8: warning: unsequenced modification and access to 'x' [-Wunsequenced]
foo[x++] = x;Language that is complicated in syntax also ended up with discussion like that. A couple of day ago you have the VisiCalc guy talked about he need to do a stack machine against the expectation here.
Think of lisp But then lisp require parentheses
Think of j but the strange right hand side then fork/train.
It is hard for this simple thing. Even = and =: get Python dictator for life resigned.
Just hard
I did not check C++ but for C, according to ISO/IEC 9899:1999 section 6.5.16 paragraph 4 on the semantics of the assignment operator: "The order of evaluation of the operands is unspecified."