How to be more careful about null pointers?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 28 14:24:48 PDT 2016


On Monday, 28 March 2016 at 21:01:19 UTC, cy wrote:
> No exception raised for dereferencing a null.

If it didn't give the error, either you swallowed it or you 
didn't actually dereference null.

The latter is a kinda strange happenstance, but if you are 
calling a static or final method on an object and it doesn't 
actually use any member variables, it is possible for the call to 
succeed even if null.

void doSomething(void* this) {
   // if you never actually use this....
}

// then this is no error:

doSomething(null);


What is the db library you are using? Did you compile it along 
with your program or use a .lib with it?


More information about the Digitalmars-d-learn mailing list