We explain it by expecting undefined behaviour rather than any particular result. As the expression attempts to modify x multiple times without an intervening sequence point its behaviour is undefined.
More Related Contents:
- Why is unsigned integer overflow defined behavior but signed integer overflow isn’t?
- Do I need to cast to unsigned char before calling toupper(), tolower(), et al.?
- May I treat a 2D array as a contiguous 1D array?
- Why does left shift operation invoke Undefined Behaviour when the left side operand has negative value?
- Undefined behavior and sequence points reloaded
- Why do constant expressions have an exclusion for undefined behavior?
- How is a variable at the same address producing 2 different values? [duplicate]
- Why dereferencing a null pointer is undefined behaviour?
- Enforcing statement order in C++
- Why should I not try to use “this” value after “delete this”?
- C++ compilation bug?
- Is this infinite recursion UB?
- Order of evaluation of assignment statement in C++
- Multiple preincrement operations on a variable in C++(C ?)
- Does not evaluating the expression to which sizeof is applied make it legal to dereference a null or invalid pointer inside sizeof in C++?
- In C++11, does `i += ++i + 1` exhibit undefined behavior?
- Virtual destructor and undefined behavior
- Why are arguments which do not match the conversion specifier in printf undefined behavior?
- Arithmetic right shift gives bogus result?
- Is pointer comparison undefined or unspecified behavior in C++?
- Why is the phrase: “undefined behavior means the compiler can do anything it wants” true?
- Near constant time rotate that does not violate the standards
- Logical AND, OR: Is left-to-right evaluation guaranteed?
- Are pointer variables just integers with some operators or are they “symbolic”?
- Undefined behavior causing time travel
- The behaviour of floating point division by zero
- Why doesn’t vector::clear remove elements from a vector?
- Setting extra bits in a bool makes it true and false at the same time
- In which versions of the C++ standard does “(i+=10)+=10” have undefined behaviour?
- Fun with uninitialized variables and compiler (GCC)