C++ What is the earliest undefined behavior can manifest itself?

前端 未结 5 1346
臣服心动
臣服心动 2021-01-17 19:48

I\'m aware that undefined behavior can potentially cause anything, which makes any program containing UB potentially meaningless. I was wondering if there is any way to iden

5条回答
  •  北海茫月
    2021-01-17 20:08

    "Undefined behavior" means that the language definition doesn't tell you what your program will do. That's a very simple statement: no information. You can speculate all you like about what your implementation may or may not do, but unless your implementation documents what it does, you're only guessing. Programming isn't about guessing; it's about knowing. If the behavior of your program is undefined, fix it.

提交回复
热议问题