My review of the C standard library in practice
> A null pointer legitimately and usefully points to a zero-sized object.<p>I agree with many points from the article but strongly disagree with this one.<p>It makes much more sense to treat a null pointer as an invalid, not present, object. Treating null pointer as an empty string (perhaps by expecting them first N pages to contain just \0 bytes, as various older Unix systems predating Linux did) feels like a recipe to hide bugs.<p>For example, I want to distinguish the output from getenv of "the variable was found but has an empty value" from "the variable was not defined".<p>If you have some random struct Foo, it's very clear that a null Foo pointer just means "no valid Foo value" and attempting to dereference it should crash (rather than optimistically return ~random data and naively continuing program execution, making bugs harder to detect).<p>I expect any reasonable programmer would suggest treating a string (or array of any types) identically.