Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!umich!srvr1!mondo.engin.umich.edu!mystone From: mystone@mondo.engin.umich.edu (Dean Yu) Newsgroups: comp.sys.mac.programmer Subject: Re: StripAddress and pointer arithmetic Message-ID: <1990May25.233110.1715@caen.engin.umich.edu> Date: 25 May 90 23:31:10 GMT References: <1990May25.194025.9751@csrd.uiuc.edu> Sender: news@caen.engin.umich.edu (CAEN Netnews) Reply-To: mystone@caen.engin.umich.edu Organization: Computer Aided Engineering Network, University of Michigan Lines: 36 In article <1990May25.194025.9751@csrd.uiuc.edu> bruner@sp15.csrd.uiuc.edu (John Bruner) writes: >I've just read the technical note on StripAddress (#213, April 1990). >On the second page under the (sub)heading "Ordered Address Comparison" >it says > > [Passage from TN 213 deleted] > >Taken literally, this means that it is unsafe to write > > struct something *p, things[64]; > > for (p = things; p < things + 64; p++) > ... > >because one can't rely upon the comparison "p < things+64" working. >This type of expression is very common in C (and is sanctioned by the >ANSI standard). I don't really believe this will fail, because the >high bits in the expressions "things" and "things + 64" will almost >certainly be the same (unless it would wrap in a 24-bit address >space). > Actually, this would work. The Tech Note was working under the assumption that the pointers/handles you were sorting were unrelated, and might have their high byte in different states. (Some locked, others purgeable, etc...) Since you're assigning p to thing, the two are refererencing the same address, so comparisons, sorts, and all that fun stuff would work fine. _______________________________________________________________________________ Dean Yu | E-mail: mystone@caen.engin.umich.edu Mac Support & | Real-mail: Dean Yu Self declared License Czar | Rm 145 Chrysler Center University of Michigan | 2121 Bonnisteel Computer Aided Engineering Network | Ann Arbor, MI 48109 INCLUDE 'Disclaimers.a' | Phone: (313) 763-3070 -------------------------------------------------------------------------------