News for hackers. Stuff that matters.
Re:Int a = 5; a = a++ + ++a; a =? (2011) by HarHarVeryFunny on Friday May 15, 2026 @08:53AM (#48147976)
I was wrong.

I was looking at this:

https://en.cppreference.com/cpp/language/eval_order

I'm not sure where precisely this sequencing exception to the default "eval order undefined" rule is given, but after the 24(!) sequencing rules they do give this "++i + i++" as an explicit example of undefined behavior.

Interestingly that page says that since C++17 f(++i, ++i) is "unspecified" rather than "undefined", whatever that means, and presumably plus(++i, i++) would be too, which seems a bit inconsistent.

There are no comments on this comment yet.