Skip to content
  • Mike Fleetwood's avatar
    C++11: Convert NULL to nullptr (!117) · 40665913
    Mike Fleetwood authored and Curtis Gedak's avatar Curtis Gedak committed
    In C++11, nullptr [1] is the strongly typed value to use instead of the
    macro NULL [2].  Use everywhere [3][4].
    
    [1] nullptr, the pointer literal (since C++11)
        https://en.cppreference.com/w/cpp/language/nullptr
    [2] NULL
        https://en.cppreference.com/w/cpp/types/NULL
    [3] Bjarne Stroustrup's C++ Style and Technique FAQ, Should I use NULL
        or 0?
        https://www.stroustrup.com/bs_faq2.html#null
            "In C++, the definition of NULL is 0, so there is only an
            aesthetic difference.  I prefer to avoid macros, so I use 0.
            Another problem with NULL is that people sometimes mistakenly
            believe that it is different from 0 and/or not an integer.  In
            pre-standard code, NULL was/is sometimes defined to something
            unsuitable and therefore had/has to be avoided.  That's less
            common these days.
    
            If you have to name the null pointer, call it nullptr; that's
            what it's called in C++11.  Then, "nullptr" will be a keyw...
    40665913