Exception/Error division in D

Jonathan M Davis jmdavisProg at gmx.com
Fri Jun 1 12:53:00 PDT 2012


On Friday, June 01, 2012 14:16:48 Tobias Pankrath wrote:
> 90% of null pointer dereferences are simple bugs not memory
> corruption.

True, but it means that you have a logic bug, which means that your program is 
in an invalid state anyway, and continuing could do who-knows-what. If you 
want to handle dereferencing null pointers, then simply check the pointer 
before dereferencing it.

And even if 90% of null pointer dereferences are simple bugs and not memory 
corruption, the program has _no_ way of knowing which it's dealing with, so it 
must assume the worst case scenario.

- Jonathan M Davis


More information about the Digitalmars-d mailing list