The comma sequence operator introduces a sequence point in an expression. I am wondering whether this means that the program below avoids undefined behavior.
int x, y;
int main()
{
return (x++, y) + (y++, x);
}
If it does avoid undefined behavior, it could still be unspecified, that is, return one of several possible values. I would think that in C99, it can only compute 1, but actually, various versions of GCC compile this program into an executable that returns 2. Clang generates an executable that returns 1, apparently agreeing with my intuition.
Lastly, is this something that changed in C11?