C and C++ could have non_nullable pointers, easily
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. ;-)
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
