Hacker News new | ask | show | jobs
by tialaramex 332 days ago
It is nice that, unlike C++, the C language standard does list all the Undefined Behaviour (in Annex J.2), it's a pretty long list and IMO it's terrifying, not so much because of specifics like this:

"A searching or sorting utility function is called with an invalid pointer argument, even if the number of elements is zero"

But because of broad choices like:

"The execution of a program contains a data race"

"An object is referred to outside of its lifetime"

These are essentially categories of mistake we know programmers make, and in C the result is... Undefined Behaviour. No diagnostics, no exit, no errors, just throw your hands in the air and give up, anything might happen.