当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - Compiler differences in g++ 4.7.2 and Intel 13.0.1 vs clang++ 3.2 and g++ 4.8

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: