kk_oop said:
So according to the C++ standard,
the constant 0, when used as a pointer rvalue, is really an abstraction
for null pointer.
So why put an abstraction on top of an abstraction? What's the point? It's
just one of those things that you have to know when using C++ - 0 means
invalid pointer. Using NULL doesn't free you from understanding this
concept, and you won't be redefining NULL at a later date because something
in your system changes (as would be the case, for example, with a magic
number like MAX_ARRAY_SIZE or something.) So in my mind there are zero
advantages to using a macro NULL. If you don't understand that 0 is a null
pointer, and you're using NULL to shield yourself from having to get that
knowledge, you're going to run into trouble. If you do understand that 0 is
a null pointer, then there isn't any reason to add NULL as an extra layer of
veneer to your program. If NULL were a keyword, like true and false are for
bool, then that would be a different matter. Then the implementation of 0
for null pointer would be irrelevant. But until we get such a keyword, 0 is
the most obvious and direct symbol to use. Obviousness and directness are
good, unless you have good reason to obfuscate.