Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c Subject: Re: detecting invalid pointers Message-ID: <769@twwells.uucp> Date: 12 Mar 89 04:05:19 GMT References: <18460@iuvax.cs.indiana.edu> Reply-To: bill@twwells.UUCP (T. William Wells) Distribution: usa Organization: None, Ft. Lauderdale Lines: 24 Summary: Expires: Sender: Followup-To: Keywords: In article <18460@iuvax.cs.indiana.edu> bobmon@iuvax.cs.indiana.edu (RAMontante) writes: : Hmm, this leads me to a question. I think I understand that pANS requires a : valid comparison of pointers that refer to the same object (esp. array). : But does the compiler or run-time code need to KNOW that the pointers are to : the same object for this to hold? Or is it sufficient that the pointers : refer to memory that is somehow associated (by malloc'ing perhaps)? : : To put it another way -- If I get tricky enough with indirection, casting, : etc. (but I only do legal things), is it possible/legal to wind up with a : pointer comparison that is NOT guaranteed to produce a "correct" answer : within the bounds of pANS? No. The whole point of sticking with legal things is that, after you are done, it all still works. So, for as long as each cast is a valid one, indirection is only done when the pointer is of the right types, and all the other things that are supposed to be done correctly are in fact done correctly, one is not supposed to be able to produce an "incorrect" answer. --- Bill { uunet | novavax } !twwells!bill (BTW, I'm going to be looking for a new job sometime in the next few months. If you know of a good one, do send me e-mail.)