Does int a=1, b=a++; invoke undefined behavior?

后端 未结 1 1587
南方客
南方客 2021-02-05 10:07

Does int a=1, b=a++; invoke undefined behavior? There is no sequence point intervening between the initialization of a and its access and modification

1条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 10:41

    It doesn't invoke undefined behaviour. In 6.7.6 (3), it is stated

    A full declarator is a declarator that is not part of another declarator. The end of a full declarator is a sequence point.

    that the end of a full declarator is a sequence point.

    int a = 1, b = a++;
         //  ^ end of full declarator
    

    0 讨论(0)
提交回复
热议问题