6.5.17 Comma operator

Syntax

1

expression:

assignment-expression

expression , assignment-expression

Semantics

2

The left operand of a comma operator is evaluated as a void expression; there is a sequence point after its evaluation. Then the right operand is evaluated; the result has its type and value.[1] If an attempt is made to modify the result of a comma operator or to access it after the next sequence point, the behavior is undefined.

3

EXAMPLE As indicated by the syntax, the comma operator (as described in this subclause) cannot appear in contexts where a comma is used to separate items in a list (such as arguments to functions or lists of initializers). On the other hand, it can be used within a parenthesized expression or within the second expression of a conditional operator in such contexts. In the function call

f(a, (t=3, t+2), c)

the function has three arguments, the second of which has the value 5.

Forward References

Footnotes