问题描述:

This question already has an answer here:

  • Why are these constructs (using ++) undefined behavior?

    10 answers

网友答案:

All of the compilers are right.

In the line

a = b = a+++a;

you invoke Undefined Behaviour, because a gets modified twice without an intervening sequence point. If you do that, the C++ standard gives the compilers licence to do whatever they like.

相关阅读:
Top