I have seen below macro in many topmost header files:
#define NULL 0 // C++03
In all over the code, NULL
and 0
are u
You shouldn't be defining it at all, unless you're writing your own version of
; it certainly shouldn't be in "many topmost header files".
If you are implementing your own standard library, then the only requirement is
18.2/3 The macro NULL is an implementation-defined C++ null pointer constant
so either 0
or nullptr
is acceptable, and nullptr
is better (if your compiler supports it) for the reason you give.