Don’t use zero as null pointer constant.
From the developer notes:
nullptr
is preferred overNULL
or(void*)0
.
From the C++ Core Guidelines:
ES.47: Use
nullptr
rather than0
orNULL
Reason Readability. Minimize surprises:nullptr
cannot be confused with anint
.nullptr
also has a well-specified (very restrictive) type, and thus works in more scenarios where type deduction might do the wrong thing onNULL
or0
.
Found by compiling the project with -Wzero-as-null-pointer-constant
and fixing where appropriate (skipping false positives).