Path: utzoo!attcan!uunet!cs.utexas.edu!csd4.csd.uwm.edu!mailrus!purdue!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Uninitialized externals and statics. Message-ID: <10810@smoke.BRL.MIL> Date: 24 Aug 89 18:02:31 GMT References: <2128@infmx.UUCP> <10764@smoke.BRL.MIL> <478.nlhp3@oracle.nl> <1989Aug19.053711.7462@twwells.com> <1786@crdgw1.crd.ge.com> <783@skye.ed.ac.uk> <7550@cg-atla.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 15 In article <7550@cg-atla.UUCP> fredex@cg-atla.UUCP (Fred Smith) writes: -It is appropriate when testing a pointer against -for being the null pointer to do a case, thusly: - if (foo == (char *)NULL) -but then doing such a cast is ALWAYS appropriate, on any machine, since -right after you leave the company somebody will get the bright idea -of porting your code to some new whiz-bang-100 processor with weird -architecture. This is also apprpriate on 8086-class machines, since -the representation of a pointer, including the null pointer, will vary -with memory model. (I hate segmented architectures.) The cast would be necessary only if the implementor has screwed up the definition of NULL. #define NULL 0 would always be a correct implementation definition for NULL, and the cast would never be necessary. We explain this in this newgroup every few months..