Path: utzoo!attcan!uunet!husc6!mailrus!ames!pasteur!ucbvax!decwrl!cookie.dec.com!devine
From: devine@cookie.dec.com (Bob Devine)
Newsgroups: comp.lang.c
Subject: Re: Let's define our own NULL II
Message-ID: <8806242243.AA19295@decwrl.dec.com>
Date: 24 Jun 88 22:43:07 GMT
Organization: Digital Equipment Corporation
Lines: 22

navtech!mark wrote:
> 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  if they only need a definition of
> "NULL" in a module.

  Quick answer: "It depends".  If every file is including stdio.h
(or stddef.h for ANSI-C) anyway then what is the use of having 
another include file?  This all devolves to the point that some
common file *has* to be included anyway: yours or the standard file.

  However if you already do have a project-wide include file, you
could make your own definition for NULL (you can choose any value
for it as long as it is 0 ;-)

  But then I never use NULL.  I use 0 cast appropriately because
that is both correct and, I believe, more informative to readers.
There is no single definition of NULL that is portable and correct
in every situation.  A cast must be used in some situations on
some machine for some functions.  Casts in C are easy to write.

Bob Devine