Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!wugate!uunet!crdgw1!crdos1!davidsen From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) Newsgroups: comp.std.c Subject: Re: Out-of-bounds pointers Summary: Just a few comments and a question Message-ID: <868@crdos1.crd.ge.COM> Date: 6 Oct 89 16:07:06 GMT References: <1009@mtxinu.UUCP> <12570028@hpclwjm.HP.COM> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: GE Corp R&D Center Lines: 32 In article <12570028@hpclwjm.HP.COM>, walter@hpclwjm.HP.COM (Walter Murray) writes: | Doug Gwyn: | | > It's not even "legal" to compute an invalid address, whether or not | > it is dereferenced. While this is obviously true, I have never understood the rationale of this decision. Given that (a) there are existing programs which do this, for reasons other than sloppy programming, (b) most implementations happily allow this, and (c) if you are allowed to declare an auto pointer at all then obviously the hardware supports uninitialized pointers, I fail to see what benefit is gained. Yes, I do understand the diference between calculating such a pointer and dereferencing it, and obviously dereferencing it is obviously non-portable. The only reason I have heard is the argument that there might be (or is) a machine such that (a) it checks addresses stored in address registers when stored, (b) the checking can't be turned off by software, and (c) the machine is incapable of storing the address in memory or any other pointer and loading it into the pointer register only when dereference is needed. Could someone clarify this, since it certainly is not prevailing practice? -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon