4 ms·
I think parent commenter made a joke. UB can be seen as "implementation defines this to reformat your hard drive. No we don't document it". That is, the compil
by thomashabets2 5mo ago
I think parent commenter made a joke. UB can be seen as "implementation defines this to reformat your hard drive. No we don't document it".
That is, the compiler de facto defines what happens when you compile UB code.
So you're not wrong, but I think you missed the sarcastic spin of parent.
- Maxatar 5mo ago>That is, the compiler de facto defines what happens when you compile UB code. That is not what undefined behavior is though, that is unspecified behavior. The entire point of undefined behavior is to cover the cases where the compiler can't define the semantics of your program either because doing so is genuinely not possible, or is incredibly onerous to deduce, or would require introducing runtime checks whose performance cost is at odds with C and C++'s predominant use cases.
- thomashabets2 5mo agoSorry, by "de facto defines" I meant that it factually does something, even if that "something" is "segfault the compiler at build time". That "de facto" did some heavy lifting.