Is a C++ compiler allowed to emit different machine code compiling the same program?

前端 未结 4 1522
夕颜
夕颜 2020-12-06 13:17

Consider a situation. We have some specific C++ compiler, a specific set of compiler settings and a specific C++ program.

We compile that specific programs with that

4条回答
  •  伪装坚强ぢ
    2020-12-06 13:38

    There is no guarantee that they will be the same. Also according to http://www.mingw.org/wiki/My_executable_is_sometimes_different

    My executable is sometimes different, when I compile and recompile the same source. Is this normal?

    Yes, by default, and by design, ~MinGW's GCC does not produce ConsistentOutput, unless you patch it.

    EDIT: Found this post that seems to explain how to make them the same.

提交回复
热议问题