An unsequenced operation is an evaluation relationship in which the relative order of two evaluations is not specified. Function-argument expressions, for example, may execute in either order or be interleaved, allowing optimizing compilers more freedom. section 19.2
Modifying and reading the same object
printf("%lld\n", x++ + x); is unsafe because the update of x may occur before, after, or while the other read occurs. The result can be twice the initial value, the initial value plus one, or a value assembled from different computation phases. TAKEAWAY: Don’t read and modify the same object within one arithmetic expression. section 15.3.2
Pointer aliases
printf("%lld\n", (*p)++ + (*q)); is safe only if p and q designate different objects. If p == q, the expression has the same underlying collision as the direct-variable example, even when the pointers were assigned in unrelated parts of the program. section 15.3.2
Sequence points impose serialization between parts of execution, but they do not generally dictate which independent expressions run first. Signal handlers and concurrent threads create related unsequenced accesses that require special conditions and mechanisms. section 19.2 section 15.3.2
