Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Edited by NavBot (vkp)

...

Wiki Markup
According to C99 Section 6.5 \[[ISO/IEC 9899:1999|AA. References#ISOBibliography#ISO/IEC 9899-1999]\] (see also [undefined behavior 32 | CC. Undefined Behavior#ub_32] of Annex J):

...

Wiki Markup
The following sequence points are defined in Annex C, Sequence Points, of C99 \[[ISO/IEC 9899-1999|AA. References#ISOBibliography#ISO/IEC 9899-1999]\]:

  • The call to a function, after the arguments have been evaluated.
  • The end of the first operand of the following operators:
    • logical AND: &&
    • logical OR: ||
    • conditional: ?
    • comma operator: ,
  • The end of a full declarator.
  • The end of a full expression:
    • an initializer
    • the expression in an expression statement (that is, at the semicolon)
    • 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 before a C standard library function returns.
  • After the actions associated with each formatted input/output function conversion specifier.
  • Immediately before and immediately after each call to a comparison function, by a standard searching or sorting function, and between any call to a comparison function and any movement of the objects passed as arguments to that call.

...

Wiki Markup
\[[ISO/IEC 9899:1999|AA. References#ISOBibliography#ISO/IEC 9899-1999]\] Section 5.1.2.3, "Program execution," Section 6.5, "Expressions," and Annex C, "Sequence points"
\[[ISO/IEC PDTR 24772|AA. References#ISOBibliography#ISO/IEC PDTR 24772]\] "JCW Operator precedence/Order of Evaluation" and "SAM Side-effects and order of evaluation"
\[[MISRA 04|AA. References#MISRABibliography#MISRA 04]\] Rule 12.1
\[[Summit 05|AA. References#SummitBibliography#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. References#SaksBibliography#Saks 07]\]

...

EXP20-C. Perform explicit tests to determine success, true-false, and equality      03. Expressions (EXP)      EXP31-C. Avoid side effects in assertions