Subject: Re: NULL return value checking
To: NetBSD Kernel Technical Discussion List <firstname.lastname@example.org>
From: Greywolf <email@example.com>
Date: 04/24/2002 08:56:42
On Wed, 24 Apr 2002, Greg A. Woods wrote:
# Regardless of which coding standard one might choose to follow, I think
# it's important to note that every good C programmer must learn to read C
# code which uses the implicit comparison against zero in conditionals.
# [ K&R don't even seem to mind mixing assignments and test expressions
# for conditional statements, and nor do I! :-) ]
Indeed, I thought that was one of the stronger points of the C language
to begin with, along with the possible convolution of code using the ?:
The shorthand notation is what made the language more attractive to use
than, say, Pascal -- at least while I was in school. One didn't HAVE to
do all the preamble and runaround required with Pascal (it's arguably
better form to do so (which, to me, indicates that cases can be made
for as well as against)).
Since we're talking about style here -- and all style is a matter of
opinion -- I find any overly pedantic style to be actually repulsive.
Being TOO pedantic beyond reasonable integrity inhibits progress --
one ends up paying more attention to form than to function.
That said, I do think that doing a ! comparison with a pointer instead
of a comparison to NULL in whatever form is probably still borrowing
NetBSD: daemonic power.