On Undefined Behavior

前端 未结 7 2113
盖世英雄少女心
盖世英雄少女心 2021-01-02 04:14

Generally, UB is regarded as being something that has to be avoided, and the current C standard itself lists quite a few examples in appendix J.

However, there are c

7条回答
  •  借酒劲吻你
    2021-01-02 04:52

    If the standard says that doing something is undefined, then it is undefined. You may like to think you can predict what the outcome will be, but you can't. For a specific compiler you may always get the same result, but for the next iteration of the compiler, you may not.

    And undefined behaviour is so EASY to avoid - don't write code like that! So why do people like you want to mess with it?

提交回复
热议问题