Null: The never-ending story

Posted by Michał ‘mina86’ Nazarewicz on 27th of March 2011

I have already mentioned some problems with the null pointer but my recent discovery knocked my socks off.

By now, it should come with no surprise to anyone that 0 in pointer context acts as a null pointer (no matter of its actual representation). Moreover, it takes only a tiny bit of experimenting to figure out that expressions like (int)0 do as well. The latter is in itself a bit of a pita but it is conforming to the C++ standard which says: