Path: utzoo!attcan!telly!lethe!torsqnt!jarvis.csri.toronto.edu!mailrus!ncar!unmvax!bbx!bbxsda!scott From: scott@bbxsda.UUCP (Scott Amspoker) Newsgroups: comp.lang.c Subject: Re: Abandon NULL for (0) Message-ID: <152@bbxsda.UUCP> Date: 22 Sep 89 15:50:16 GMT References: <6502@ux.cs.man.ac.uk> <14718@bfmny0.UU.NET> <146@bbxsda.UUCP> <17505@pasteur.Berkeley.EDU> Reply-To: scott@bbxsda.UUCP (Scott Amspoker) Organization: Basis International, Albuquerque, NM Lines: 26 In article <17505@pasteur.Berkeley.EDU> jas@postgres.berkeley.edu (Jim Shankland) writes: >>At home I use 0 for a null pointer. I test pointers with expressions >>like: >> if (pointer)... /* at home */ >> if (!pointer)... > >Stylistically a little dubious, in my opinion, but certainly widely ^^^^^^^^^^^^^^ I guess that's where personal preference comes in. I consider it a lot easier to read that way (and to type in :-). >>as opposed to >> >> if (pointer!=(char *)0) /* at work */ >> >Modern C compilers will reliably generate warnings on this if `pointer' >has any type other than `char *'. Sorry I wasn't clear on this. It was simply a general example. Of course I would use the appropriate pointer type in the cast. -- Scott Amspoker Basis International, Albuquerque, NM (505) 345-5232