Let's define our own NULL II

Richard Harter g-rh at cca.CCA.COM
Fri Jun 24 13:56:19 AEST 1988


In article <162 at navtech.uucp> mark at navtech.uucp (Mark Stevans) writes:
>So far, most responders to the article I posted on Wednesday have not addressed
>my question.  I am not asking about what is a legal definition of NULL.  I am
>asking whether one should define NULL in a product-wide header file *just* so
>that people won't have to include <stdio.h> if they only need a definition of
>"NULL" in a module.

	Mark summarizes arguments pro and con.  I won't argue one way or the
other as to whether it's the right thing to do, but here's what we did and
why.

	In our standard header file we define null as 0 (note lower case)
with the standard meaning that it is a null pointer.  This takes care of
all conflict problems without playing ifdef games at the price, of course,
of adding a nonstandard keyword.  We specifically rejected the notion of
including stdio.h in all files, partly on methodological prejudices, and
partly because our software runs on a variety of operating systems.  Fopen
and kin vary in treatment across operating systems; life is much simpler if
calls to these routines are carefully isolated and are explicitly noted.
-- 

In the fields of Hell where the grass grows high
Are the graves of dreams allowed to die.
	Richard Harter, SMDS  Inc.



More information about the Comp.lang.c mailing list