6.5.17 Comma operator

Previous Table of Contents "New C Standard" commentary

1313

expression:
                assignment-expression
                expression , assignment-expression

1314 The left operand of a comma operator is evaluated as a void expression;

1315 there is a sequence point after its evaluation.

1316 Then the right operand is evaluated;

1317 the result has its type and value.95)

1318 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.

1319 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.

1320 95) A comma operator does not yield an lvalue.

1321 Forward references: initialization (6.7.8).

Next

Created at: 2008-01-30 02:39:43 The text from WG14/N1256 is copyright © ISO