dereferencing null

David Nadlinger see at klickverbot.at
Fri Mar 2 04:14:58 PST 2012


On Friday, 2 March 2012 at 09:22:28 UTC, Peter Alexander wrote:
> You only get an error if there is a memory access involved 
> (vtable, member data etc.)

By the way, my favorite application of that in C++ is debug 
helper member functions (think: using DMD's toChar() in GDB), 
which don't crash when invoked on a null pointer by checking if 
(this == 0) before accessing member variables.

David


More information about the Digitalmars-d mailing list