How does D handle null pointers?

Adam D. Ruppe destructionator at gmail.com
Mon Aug 23 13:36:47 PDT 2010


On Mon, Aug 23, 2010 at 01:30:15PM -0700, Adam B wrote:
> I was pondering bearophile's idea of having compile-time null
> checking.  Since adding new language syntax is often a hard thing to
> sell to the language authors, perhaps we could get by with just a
> compiler warning?  Some static code analysis. 

Try compiling with optimizations turned on (-O). It catches some null uses
with that.

Though note that a null array is the same as an empty array - you can actually
use it without fear.

It doesn't catch all cases, but it sees some of them.



More information about the Digitalmars-d mailing list