Re:The Logical Disaster of Null
by xamuel on Thursday May 10, 2018 @09:42AM
(#17038727)
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.
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.