Search code examples
c++c++11language-designnull-pointernullptr

Why not call nullptr NULL?


In C++11 the nullptr keyword was added as a more type safe null pointer constant, since the previous common definition of NULL as 0 has some problems.

Why did the standards committee choose not to call the new null pointer constant NULL, or declare that NULL should be #defined to nullptr?


Solution

  • Stephan T. Lavavej (member of the C++ standard committee) explained that once in a talk (55:35):

    While an implementation is allowed to #define NULL nullptr, it would break quite some uses like

    int i = NULL;
    

    and apparently there are plenty of those. So they could not force the change.