Just one more point in favor of the foo == NULL
practice:
If foo
is, say, an int *
or a bool *
, then the if (foo)
check can accidentally be interpreted by a reader as testing the value of the pointee, i.e. as if (*foo)
. The NULL
comparison here is a reminder that we're talking about a pointer.
But I suppose a good naming convention makes this argument moot.