Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
The following sequence points are defined by C99 \[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\]:

  • The the call to a function, after the arguments have been evaluated.
  • The the end of the first operand of the following operators: && (logical AND); || (logical OR); ? (conditional); , (comma, but see the note below).
  • The the end of a full declarator.
  • The the end of a full expression: an initializer; the expression in an expression statement; the controlling expression of a selection statement (if or switch); the controlling expression of a while or do statement; each of the expressions of a for statement; the expression in a return statement.
  • Immediately immediately before a library function returns.
  • After after the actions associated with each formatted input/output function conversion specifier.
  • Immediately immediately before and immediately after each call to a comparison function, and also between any call to a comparison function and any movement of the objects passed as arguments to that call.

Note that not all instances of a comma in C code denote a usage of the comma operator. For example, the comma between arguments in a function call is NOT the comma operator.

...

Programs cannot safely rely on the order of evaluation of operands between sequence points. In this non-compliant code example, the order of evaluation of the operands to the + operator are is unspecified.

Code Block
bgColor#FFcccc
a = i + b[++i];

If i was equal to 0 before the statement, this the statement may result in the following outcome:

...

Wiki Markup
\[[ISO/IEC 9899-1999|AA. C References#ISO/IEC 9899-1999]\] Section 5.1.2.3, "Program execution," Section 6.5, "Expressions," and Annex C, "Sequence points"
\[[Summit 05|AA. C References#Summit 05]\] Questions 3.1, 3.2, 3.3, 3.3b, 3.7, 3.8, 3.9, 3.10a, 3.10b, and 3.11
\[[Saks 07|AA. C References#Saks 07]\]

...