Hacker News new | ask | show | jobs
by benj111 1372 days ago
>could be anything

Why do people say this. I mean it may be technically correct, but not reasonable by any stretch. If I put a spelling error or miss a semi colon in my code it may be legal for the compiler to do anything but that isn't reasonable. We rightly expect compilers to pick up on and point out spelling errors why do we not expect the same for UD.

Or do you also tell programmers not to make any errors because the compiler doesn't have to warn you about even the most obvious ones?

If I overflow a signed integer, I expect that to be on me, and depending on the context I could check for overflow after the fact. That isn't a licence for the compiler to do what it damn well wants, and practically speaking it doesn't really matter anyway. What processors in the past 30 years have done anything funky on integer overflow or has weird signed integers?

C gives you enough rope to hang yourself. It isn't required for the compiler to tie the noose and pull the lever.