Abandon NULL for (0)

Kim Letkeman kim at kim.misemi
Sun Sep 24 00:55:58 AEST 1989


In article <14678 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>Despite which, there *are* good reasons for not doing it.  
>The word "NULL" has been conventionally used for decades 
>[...]
>In particular, if I were maintaining that code, I'd change the "(0)"'s 
>back to "NULL"'s as fast as I found them. 
>[...]

Finally, someone has addressed the most important issue with that
posting ... the fact that using "(0)" instead of "NULL" makes the
program harder to read and maintain. There are enough brackets (and
braces and ellipses) in the average program without adding more as a
superfluous replacement for a good convention. I also did not like the
original author's tendency to write the NULL first in a comparison
(e.g. if (NULL == some_ptr)) because this obscures the fact that the
pointer is the object of interest. The value for which you are
comparing is secondary (although important.)

-- 
Kim Letkeman    uunet!mitel!spock!kim



More information about the Comp.lang.c mailing list