Path: utzoo!mnetor!uunet!husc6!mailrus!umix!umich!crim!janc From: janc@crim (Jan Wolter) Newsgroups: comp.sources.bugs Subject: Re: pointer checking Message-ID: <785@zippy.eecs.umich.edu> Date: 22 Feb 88 15:10:55 GMT References: <228@gandalf.littlei.UUCP> <1204@itm.UUCP> <779@zippy.eecs.umich.edu> <325@halley.UUCP> Sender: news@zippy.eecs.umich.edu Reply-To: janc@crim.eecs.umich.edu (Jan Wolter) Followup-To: comp.lang.c Organization: University of Michigan EECS, Ann Arbor Lines: 45 Summary: Partial quotes may be misleading UUCP-Path: crim!janc In article <325@halley.UUCP> bc@halley.uucp (Bill Crews) writes: > All right, I know and I am sure most of you out there know that Jan is > supplying us with incorrect information in this message. [...] If you > really don't understand why he (she?) is wrong, please REPLY to me, read > K&R CAREFULLY, or consult your local guru. Thanks. > In article <779@zippy.eecs.umich.edu> janc@palam.eecs.umich.edu (Jan Wolter) writes: > > >NULL is a pointer with an illegal value. In some architectures, the address > >0 is a perfectly reasonable address, so it is concievabale that someone might > >set up a system with NULL defined as ((char *) -1), or some such. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > If it does, it is DEAD WRONG! The 0 is interpreted by the COMPILER and by the > LIBRARY, NOT by the machine! NULL is NOT an ADDRESS! I might suggest that as a third alternative, people who don't understand this might read the next sentance in my response quoted above. The response says: > NULL is a pointer with an illegal value. In some architectures, the address > 0 is a perfectly reasonable address, so it is concievabale that someone might > set up a system with NULL defined as ((char *) -1), or some such. However, > I've never heard of anyone doing that, and, in fact, it would be contrary > to K&R's definition of C. In the future I will take care to state my facts with plenty of CAPS and exclaimation points so that Bill will not overlook them and proclaim my idiocy so stridently over the net. I can claim little expertise in what is correct C, but I do know what is portable. Bill's suggestion of casting NULL as (void *) is a dubious one, as many older compilers do not support the void type at all, or just do #define void int. I'm am not familiar with any system in which it is necessary to type cast NULL in argument lists. I don't know on what basis Bill says NULL is not a pointer (K&R says nothing to suggest that) but I know code that treats it as such is very portable. Bill claims that this has been discussed before. I would certainly not want to say anything on the net that is not new. I enter this here only to correct the misquote. Follow-ups should go to comp.lang.c. Thank you for your patience, Jan Wolter janc@crim.eecs.umich.edu