News for hackers. Stuff that matters.
Re:Falsehoods programmers believe about undefined behavior by gpderetta on Monday November 28, 2022 @10:12AM (#33774572)
You are indeed correct. I would add that there are some instances of UB that actually UB at translation time: for example ODR violations and some preprocessor dark corners. At least the latter is getting stamped out.
Re:Falsehoods programmers believe about undefined behavior by leni536 on Monday November 28, 2022 @02:19PM (#33778206)
The C++ standard calls these "ill-formed, no dioagnosrics required" instead of UB, although it's not always consistent. It is indeed more or less "translation-time UB". The difference is exactly that affected lines don't need to be in the execution path to make all executions undefined, and that the compiler/linker may fail the translation.