Pointer if test for for NULL
Andrei Chichak
groups at chichak.ca
Thu Apr 29 03:41:20 UTC 2010
>
OPINION_WHICH_IS_MINE
In matters like this, I err on the side of "what is the junior programmer who has to maintain this stuff going to think I mean?"
Stylistic stuff like this always starts flame wars. The gurus want the code to be terse and cryptic because their job depends on their unique understanding to provide billable hours and an understanding hurdle to their personal pedestal. The mature programmer has empathy for those who follow, because the poor guy that has to maintain the stuff may be themselves.
For me, my memory for minutiae is pretty much shot, so when I see stuff like "if (p)" I have to whip out K&R and remind myself what the value of TRUE and FALSE are.
Both will probably compile into the same code, so the compiler doesn't care, but this is all about communicating concepts.
I'd go with "if (p != NULL)", but I'm new at this game, I've only been doing it for 32 years.
A
*OPINION_WHICH_IS_MINE
More information about the users
mailing list