Sequence point

A sequence point defines any point in a computer program's execution at which it is guaranteed that all side effects of previous evaluations will have been performed, and no side effects from subsequent evaluations have yet been performed. They are often mentioned in reference to C and C++, because they are a core concept for determining the validity and, if valid, the possible results of expressions. Adding more sequence points is sometimes necessary to make an expression defined and to ensure a single valid order of evaluation.
With C++11, usage of the term sequence point has been replaced by sequencing. There are three possibilities:
The execution of unsequenced evaluations can overlap, with catastrophic undefined behavior if they share state. This situation can arise in parallel computations, causing race conditions. However, it can already arise in simple non-concurrent situations like codice_1, where part of the assignment to codice_2 (eg., half of the bits) may happen before codice_3, and the rest afterwards, such that after evaluation of the expression, codice_4 may contain a meaningless intermediate state of codice_2.
Examples of ambiguity.
Consider two functions codice_6 and codice_7. In C and C++, the codice_8 operator is not associated with a sequence point, and therefore in the expression codice_9 it is possible that either codice_6 or codice_7 will be executed first. The comma operator introduces a sequence point, and therefore in the code codice_12 the order of evaluation is defined: first codice_6 is called, and then codice_7 is called.
Sequence points also come into play when the same variable is modified more than once within a single expression. An often-cited example is the C expression codice_15, which apparently both assigns codice_16 its previous value and increments codice_16. The final value of codice_16 is ambiguous, because, depending on the order of expression evaluation, the increment may occur before, after, or interleaved with the assignment. The definition of a particular language might specify one of the possible behaviors or simply say the behavior is undefined. In C and C++, evaluating such an expression yields undefined behavior. Other languages, such as C#, define the precedence of the assignment and increment operator in such a way that the result of the expression codice_15 is guaranteed.
Sequence points in C and C++.
In C and C++, sequence points occur in the following places. (In C++, overloaded operators act like functions, and thus operators that have been overloaded introduce sequence points in the same way as function calls.)