3 ms·
In languages with pointers, it's not really possible for the compiler to know when null needs to be checked for. Consider this fragment: void f(char *x) {g(&x)
by xamuel 8y ago
In languages with pointers, it's not really possible for the compiler to know when null needs to be checked for. Consider this fragment:
void f(char *x) {g(&x); printf(x);}
It's possible that calling g(&x) might cause x to no longer be null, even if x originally was null. It would then be inappropriate for the compiler to complain that the next instruction attempts to use x without checking whether x is null.