Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!edison.cho.ge.com!rja From: rja@edison.cho.ge.com (rja) Newsgroups: comp.lang.c Subject: Re: I'm confused (Re: What C compilers have non-zero null pointers?) Message-ID: <9007201132.AA06954@edison.CHO.GE.COM> Date: 20 Jul 90 11:32:53 GMT References: <30820@eerie.acsu.Buffalo.EDU> Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: rja Organization: GE-Fanuc North America Lines: 20 Actually, I don't think I worded my posting clearly. It is true without doubt that both K&R and ANS X3.159 C both guarantee that comparing a pointer to "0" is the same as comparing a pointer to "NULL." It is also something that is broken on several widely used C compilers for the Intel segmented architecture. At least one such compiler doesn't "#define NULL 0" or even "#define NULL (void *)0" and will compare the offset of the pointer to the offset of the NULL pointer address rather than comparing the whole pointer to the whole NULL pointer address. In short, yes everyone agrees that such compilers are broken but they are in common use and so experience has taught some of us to always compare to NULL rather than 0 because it is more portable to the several broken compilers for the Intel architecture. Ideally, one can simply choose to avoid such compilers, but it isn't always practical for non-technical reasons...