Comment by oxff
3 years ago
> On the other hand, there seem to be so many cases like this one where the “undefined behavior code deleter goes brrrrrr” really overextends its usefulness.
I would simply not depend on invoking UB as part of my program's behavior (?).
That's the only way to use C correctly.
Alas, it's nearly impossible for a mere mortal to write any non-trivial C code that doesn't have UB.
"a+b" for signed integer types potentially invokes undefined behavior (overflow). It's a horrendous situation.
Alternatively I would not trust myself with not doing that, which is why I don’t use C.
I don't think I ever claimed that one would or should intentionally invoke UB as part of their program's behavior?