Checking for NULL pointer in C/C++ [closed]
问题 In a recent code review, a contributor is trying to enforce that all NULL checks on pointers be performed in the following manner: int * some_ptr; // ... if (some_ptr == NULL) { // Handle null-pointer error } else { // Proceed } instead of int * some_ptr; // ... if (some_ptr) { // Proceed } else { // Handle null-pointer error } I agree that his way is a little more clear in the sense that it\'s explicitly saying \"Make sure this pointer is not NULL\", but I would counter that by saying that