Are unspecified and undefined behavior required to be consistent between compiles of the same program with the same compiler in the same environment?

前端 未结 9 1672
我在风中等你
我在风中等你 2021-01-25 22:04

Let\'s pretend my program contains a specific construct the C++ Standard states to be unspecified behavior. This basically means the implementation has to do something reasonabl

9条回答
  •  一整个雨季
    2021-01-25 23:01

    Unspecified and undefined behavior are not guaranteed to be consistent between separate runs of an already compiled program. That alone already makes the notion of consistency between separate compiles totally meaningless.

    Also, it is probably worth adding that undefined behavior can manifest itself at compilation stage by preventing the program from compiling at all.

提交回复
热议问题