|
|
|
|
|
by MaxBarraclough
33 days ago
|
|
> It's worse than that, the behavior of the entire program is unconstrained by the language standard beforehand too. Raymond Chen discusses how things can go wrong once you're going to reach UB even before you get to it Heh, yes that's exactly what I was thinking when I put roughly speaking. > where a kind C compiler might just mess with your numbers a bit, an evil C compiler can legally make demons fly out of your nose Yes, signed integer overflow being another. Presumably it's defined that way as it's simpler than trying to spell out all the behaviours the compiler is permitted to implement, and on top of that there are trap representations to worry about. I doubt modern compilers get much optimization benefit from it though. There's a StackOverflow thread discussing the reasons it's defined this way: https://stackoverflow.com/q/1860461 |
|