C and C++ could have non_nullable pointers, easily
Posted Aug 21, 2009 8:00 UTC (Fri) by
hppnq (guest, #14462)
In reply to:
C and C++ could have non_nullable pointers, easily by njs
Parent article:
Null pointers, one month later
Once it's a non-null pointer, it becomes legal to dereference.
This assumes that pointers do not change, which is only true in the trivial cases. If you want to be completely safe, your only option is to always check, right before using it, that a pointer is not NULL.
And then, by the way, you still have to worry about what will happen it turns out to be pointing to 0x1. ;-)
(
Log in to post comments)