Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!uw-beaver!tektronix!tekcrl!tekchips!danw
From: danw@tekchips.CRL.TEK.COM (Daniel E. Wilson)
Newsgroups: comp.lang.c
Subject: Re: pointers, tests, casts
Message-ID: <3340@tekcrl.CRL.TEK.COM>
Date: 30 Nov 88 22:36:12 GMT
References: <11130@dartvax.Dartmouth.EDU> <494@auspex.UUCP>
Sender: ftp@tekcrl.CRL.TEK.COM
Lines: 17

In article <494@auspex.UUCP>, guy@auspex.UUCP (Guy Harris) writes:
> >In assignments, a 0 or NULL is cast implicitly to the correct pointer
> >type (I think, please correct me if I'm wrong).
> 
> This is correct.
> 
> >What about the '==' comparison above?  Would "(ptr == 0)" get evaluated
> >correctly?

  I tend to avoid the whole problem by defining a simple macro.  Simply
by using this macro always I get a NULL pointer of the needed type.
This does avoid bugs.

     #define NIL(type) ((type *) NULL)

  Unless someone would like to give me warnings about the abuses
of macros. 8-)