2 ms·
The point of having a system-defined NULL dereference (or whatever else is UB) is predictability both at compile-time and at run-time - given a particular syste
by wk_end 4y ago
The point of having a system-defined NULL dereference (or whatever else is UB) is predictability both at compile-time and at run-time - given a particular system and a piece of high-level code, you can infer roughly what the compiled low-level code is; this means that given a bug, since odds are good you know what system the code is running on, you probably have a leg up in understanding what went wrong.
It's nice being able to strap your program into GDB and have it breakpoint at the point of a NULL dereference because it triggered a segfault, instead of needing to magically infer why results are wrong anywhere in the program because the compiler decided to inject nasal demons due to some subtle optimization pass.