News for hackers. Stuff that matters.
Re:Dereferencing NULL Pointer, without a Seg Fault by repsilat on Tuesday July 10, 2012 @10:25PM (#4227407)
According to [1] this is (strictly speaking) undefined behaviour. It also won't work with virtual function calls, because they'll try to access the vtable and segfault.

If your compiler isn't cheeky you can use this stuff in funny ways with constructs like `if(this)` in your member functions. Technically such a check could be optimised out because `this==null` can only result from undefined behaviour, but in practice it probably won't be.

1: http://stackoverflow.com/questions/2474018/when-does-invokin...

There are no comments on this comment yet.