Is there a sequence point between these assignments?

前端 未结 6 1734

Is there a sequence point between the two assignments in the following code:

f(f(x=1,1),x=2);
6条回答
  •  不知归路
    2021-02-13 10:18

    Yes, because there is a sequence point before and after function calls.

    §1.0.17 of the Standard says:

    When calling a function (whether or not the function is inline), there is a sequence point after the evaluation of all function arguments (if any) which takes place before execution of any expressions or statements in the function body. There is also a sequence point after the copying of a returned value and before the execution of any expressions outside the function).

提交回复
热议问题