What's the reason for letting the semantics of a=a++ be undefined?

后端 未结 8 1524
后悔当初
后悔当初 2020-12-08 07:18
a = a++;

is undefined behaviour in C. The question I am asking is : why?

I mean, I get that it might be hard to provide a

8条回答
  •  北海茫月
    2020-12-08 07:49

    Updating the same object twice without an intervening sequence point is Undefined Behaviour because ...

    • because that makes compiler writers happier
    • because it allows implementations to define it anyway
    • because it doesn't force a specific constraint when it isn't needed
    • ...

提交回复
热议问题