LWN.net Logo

RE: nullable pointers

RE: nullable pointers

Posted Apr 1, 2011 8:12 UTC (Fri) by neilbrown (subscriber, #359)
In reply to: RE: nullable pointers by HelloWorld
Parent article: GCC 4.6.0 released

ahh... I get it now.

What you are saying (I think) is that not only should the language provide a 'non-nullable' pointer type (which the compiler assures will never be NULL), but that where a nullable pointer is used, the language should require that there be an explicit test for NULL before dereferencing the pointer or assigning it to a non-nullable pointer.

That makes sense.

So you will never get a NULL dereference, and the compiler/runtime doesn't have to do implicit tests because tests are required to be explicit.


(Log in to post comments)

RE: nullable pointers

Posted Apr 1, 2011 12:46 UTC (Fri) by HelloWorld (guest, #56129) [Link]

> What you are saying (I think) is that not only should the language provide a 'non-nullable' pointer type (which the compiler assures will never be NULL), but that where a nullable pointer is used, the language should require that there be an explicit test for NULL before dereferencing the pointer or assigning it to a non-nullable pointer.
Yes, this is exactly what I meant.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds