by vog · 15y ago · 0 comments
What is the point of this? C++ defines the null pointer to be always 0. So I never needed the NULL macro in C++ anyway, as I'm allowed to simply type 0 instead.
In how far is that new nullptr constant preferable to writing simply 0?
void f(int x);
void f(char *x);
...
f(0); // calls void f(int)
That may seem contrived, but you may not know of the f(int) overload, especially in combination with templates.NULL, if #define'd as (void *)0, prevents that error.
int execl(const char *path, const char *arg, ...);
called like so: execl("foo", "bar", 0);
Particularly when sizeof(int) != sizeof(void *).