+ 1
NULL vs nullptr
What are the differences between NULL and nullptr? Is there a benefit for using one vs the other?
2 Respostas
+ 2
The difference is that NULL is an integer, nullptr is a pointer type. It is a crucial difference when dealing with (resolving) method overloads.
They are not interchangeable*). When you talk pointer, always use nullptr.
*) That is, think of them as not being interchangeable and always keep your types clear. Both are a 64bit zero, but the types are different, and the compiler will care about that difference.
+ 3
Peter Nicholas
NULL is passing 0 or NULL to mostly an int ( integer )version.
And
nullptr allows for both pointers and integers, usually passing nullptr to a pointer version.