int a = 5; a = a++ + ++a; a = ? (2011)
In a 2011 blog post on gynvael.coldwind.pl, Gynvael Coldwind dissects the C expression `a = a++ + ++a` with initial `a = 5`. The post explains that this expression invokes undefined behavior according to the C standard because `a` is modified more than once between sequence points. The author shows that different compilers (e.g., GCC, Clang, MSVC) produce different results: some yield 11, others 12, and some even crash. The post emphasizes that such code is non-portable and should be avoided. It also discusses the concept of sequence points and how the C99 and C11 standards address this issue. The article serves as a cautionary tale for developers about relying on evaluation order in C and C++.
Reminds developers that undefined behavior in C can produce unpredictable results across compilers.