4 ms·
I think we are talking past each other. When I said "undefined behaviour" above, I meant the concept of it. The fact that the language spec has undefined behavi
by est31 6y ago
I think we are talking past each other. When I said "undefined behaviour" above, I meant the concept of it. The fact that the language spec has undefined behaviour is what enables the compiler to make assumptions. The language spec could for example say that out of bounds indexing in an array is defined behaviour, and defined to raise a trap. But implementing that would slow down a lot of code.
You refer to the ill formed code itself that violates the language specification. That's not what I meant. Yes, the fact that this code becomes garbage is a side effect of the optimizer's assumption that code is always well formed, instead of some arcane idea of punishing people who don't follow an arbitrary specification. I think we both agree.