How does D handle null pointers?

Jonathan M Davis jmdavisprog at gmail.com
Fri Aug 20 16:50:08 PDT 2010


On Friday, August 20, 2010 16:16:33 bearophile wrote:
> Jonathan M Davis:
> >There are quite a few people who want Walter to put in null checks in at
> >least debug mode, but he's against it and no one has been able to
> >convince him.<
> 
> I think that Walter is right here, adding tons of null checks in debug mode
> helps a bit (stack traces are good), but it's just a rough patch on the
> problem, but it's not a good solution of it.

Considering that other major languages such as C# and Java do these checks with 
every dereference (though they may optimize it out in some cases), I don't think 
that it's at all unreasonable to have them in D. They'd be a huge boon to 
debugging. Now, since D is as concerned about efficiency as it is (being a systems 
language), it makes sense that those checks would be removed in release mode, 
but I still think that it would be a very good idea to have them in debug mode.

- Jonathan M Davis


More information about the Digitalmars-d mailing list