C++ FAQ Celebrating Twenty-One Years of the C++ FAQ!!!
(Click here for a personal note from Marshall Cline.)
Section 39:
[39.16] What's the deal with "sequence points"?

The C++ standard says (1.9p7),

At certain specified points in the execution sequence called sequence points, all side effects of previous evaluations shall be complete and no side effects of subsequent evaluations shall have taken place.

For example, if an expression contains the subexpression y++, then the variable y will be incremented by the next sequence point. Furthermore if the expression just after the sequence point contains the subexpression ++z, then z will not have yet been incremented at the moment the sequence point is reached.

The "certain specified points" that are called sequence points are (section and paragraph numbers are from the standard):

  • the semicolon (1.9p16)
  • the non-overloaded comma-operator (1.9p18)
  • the non-overloaded || operator (1.9p18)
  • the non-overloaded && operator (1.9p18)
  • the ternary ?: operator (1.9p18)
  • after evaluation of all a function's parameters but before the first expression within the function is executed (1.9p17)
  • after a function's returned object has been copied back to the caller, but before the code just after the call has yet been evaluated (1.9p17)
  • after the initialization of each base and member (12.6.2p3)