Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!gem.mps.ohio-state.edu!usc!apple!agate!shelby!decwrl!megatest!djones From: djones@megatest.UUCP (Dave Jones) Newsgroups: comp.lang.c Subject: Re: Abandon NULL for (0) Message-ID: <8633@goofy.megatest.UUCP> Date: 6 Oct 89 21:14:37 GMT References: <15571@nswitgould.cs.uts.oz> Organization: Megatest Corporation, San Jose, Ca Lines: 42 From article <15571@nswitgould.cs.uts.oz>, by karl_auer_%7801.801@fidogate.fido.oz (1): > There is another good reason not to use '(0)' - in some > implementations of C, pointers can have different sizes ... Aaaaarrrrggggghh!!!! Will this never cease? On many (most? all?) Unixes, NULL has nothing at all to do with pointers. Zip. Nada. Zilch. It is just a silly little macro which means 0. Look it up. It happens to reside in the stdio.h header-file, probably because somebody or another back in antiquity thought that was a cute way to say "0". Usually the compiler will figure out that you need a pointer, and explicitly cast the zero to a pointer type. But you must always cast the 0 (a.k.a NULL) to a pointer explicitly in function parameter lists, unless you have ANSII prototypes, and there is one in scope. Even then I would cast it explicitly, for safety -- the prototype might get dropped or changed -- and for clarity. Say, (void*)0 or (char*)0 or (caddr_t)0 or (FILE*)0 or whatever.