Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The standard example is:

    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.



NULL is actually #defined to 0 in C++ as void* is not implicitly convertible to any pointer type as it is in C. So unlike in C there has been no safety in using NULL. Until now.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: