콤마 연산자와 Sequence Point

Pi11ar의 이미지

C언어에서

a = (b=3, b+2);

하나의 Object에 인접한 Sequence Point사이에 값의 변경은 한번만 이루어질수있는 것으로 알고있는데
위의 코드는 Sequence Point에 의해서 저런 콤마 연산들은 비표준 코드가 되는건가요?

익명 사용자의 이미지

http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
105p 6.5.17 Comma operator
Semantics
2 The left operand of a comma operator is evaluated as a void expression; there is a sequence point between its evaluation and that of the right operand. Then the right operand is evaluated; the result has its type and value.

따라서 b=3이 실행된 후 sequence point를 거치게 되고, b+2는 5로 evaluated 됩니다. 따라서 a에 5가 대입되겠죠. 적법한 코드입니다.

Pi11ar의 이미지

.

for 梦想