Comma operator in condition of loop in C

On topic The comma operator will always yield the last value in the comma separated list. Basically it’s a binary operator that evaluates the left hand value but discards it, then evaluates the right hand value and returns it. If you chain multiple of these they will eventually yield the last value in the chain. … Read more

Is the comma in a variable list a sequence point?

I believe behavior is well-defined because of 8[dcl.decl]/3 Each init-declarator in a declaration is analyzed separately as if it was in a declaration by itself. Which is even additionally explained in a footnote as A declaration with several declarators is usually equivalent to the corresponding sequence of declarations each with a single declarator. That is … Read more

What does the comma operator do in JavaScript?

The comma operator evaluates both of its operands (from left to right) and returns the value of the second operand. Source: https://developer.mozilla.org/en/JavaScript/Reference/Operators/Special_Operators/Comma_Operator For example, the expression 1,2,3,4,5 evaluates to 5. Obviously the comma operator is useful only for operations with side-effects. console.log(1,2,3,4,5); console.log((1,2,3,4,5));

C comma operator

Section 6.6/3, “Constant expressions”, of the ISO C99 standard is the section you need. It states: Constant expressions shall not contain assignment, increment, decrement, function-call, or comma operators, except when they are contained within a subexpression that is not evaluated. In the C99 rationale document from ISO, there’s this little snippet: An integer constant expression … Read more