Re:Null Pointer Dereferencing Causes Undefined Behavior
by makomk on Tuesday April 21, 2015 @01:37PM
(#9415670)
No, it wasn't written for that purpose at all. Many of these undefined behaviours exist in the spec because long ago, there was some exotic architecture where doing that thing caused a hardware exception or behaved strangely. For instance, on some systems that are no longer in use, trying to obtain the pointer in this example would cause an access violation and abort the program because pointer calculations are checked in hardware. It was never intended as an excuse for compiler writers to randomly decide to be dicks.
[ Parent
| on HN ]
Re:Null Pointer Dereferencing Causes Undefined Behavior
by kragen on Tuesday April 21, 2015 @04:03PM
(#9416655)
There’s that, and then there’s also long-ago exotic architectures where you weren’t processing untrusted data, you really did care about improving your performance by ½%, and it really was worth the massive amount of programmer time needed to debug the resulting problems. There’s a famous apocryphal quote that writing C for the Cray (?) compiler was like “writing to [the programmer’s] ex-wife’s lawyer”.
Also, there are still Unisys Clearpath/MCP systems in use.