2 ms·
> The standard offers no interpretation of any undefined behavior, that's literally what meant by undefined Correct. > There is no execution of a program that
by MaxBarraclough 7y ago
> The standard offers no interpretation of any undefined behavior, that's literally what meant by undefined
Correct.
> There is no execution of a program that contains UB that could be considered 'valid' by the standard.
That strikes me as backward. It would be more correct to say There is no execution of a program that contains UB that could be considered 'invalid' by the standard.
Even this isn't quite precise enough though. If there's undefined behaviour in a function which is never used, that doesn't cause the program to have undefined behaviour.
> The compiler has no choice, it has to define its own interpretation.
No, it doesn't. That's only true of implementation-defined behaviour. In the case of undefined behaviour, the program doesn't even have to behave the same way every time.
https://en.wikipedia.org/wiki/Unspecified_behavior#Implementation-defined_behavior https://en.wikipedia.org/wiki/Unspecified_behavior#Implement...