Shift operands sequenced in C++17

后端 未结 1 1052
孤独总比滥情好
孤独总比滥情好 2020-12-11 01:04

I read in the C++17 Standard $8.5.7.4:

The expression E1 is sequenced before the expression E2.

for shift operators.

Als

相关标签:
1条回答
  • 2020-12-11 01:49

    Standard is clear about the order of evaluation of the operands of the shift operator.

    n4659 - §8.8 (p4):

    The expression E1 is sequenced before the expression E2.

    There is no undefined behavior in the expression i++ << i, it is well defined. It is a bug in Clang and GCC both.

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