Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!husc6!endor!siegel From: siegel@endor.harvard.edu (Rich Siegel) Newsgroups: comp.sys.mac.programmer Subject: Re: StripAddress... Message-ID: <1461@husc6.harvard.edu> Date: 2 Feb 90 08:07:00 GMT References: <1990Feb2.010425.28126@oracle.com> Sender: news@husc6.harvard.edu Reply-To: siegel@endor.UUCP (Rich Siegel) Organization: Symantec Language Products Group Lines: 40 In article <1990Feb2.010425.28126@oracle.com> gstein@oracle.uucp (Gregory Stein) writes: >[ I posted this once before and received no response, so I'm trying > again... ] > >Geez, it seems like StripAddress needs to be called *everywhere* if >you want to be 32-bit clean. If you maintain any kind of information >within a handle, it appears that you are required to call StripAddress >to access that information. Now, sure, I can dereference, strip it, >and store it so that I don't have to call StripAddress again (say, in >a sequence of stores), but as soon as I call a routine that moves >memory, I'll have to do it again. Not quite. You should call StripAddress if you want to be sure that the address you get by dereferencing a handle is clear of any extra information such as flag bits. This is useful if you're planning to do any kind of address arithmetic. However, in the normal case, you can double-indirect a locked (or purgeable, or resource) handle and still get the right thing, because the system only uses the low-order 24 bits of whatever addresses you use. When the system runs in 32-bit mode, the flag bits will be kept in some place other than the high byte of the handle, since the system will use all 32 bits of the address. This means that you can still single-and double-indirect handles safely, but you should NOT use $00FFFFFF as a mask to get rid of the flag bits, since you'll smash the upper 8 bits of a 32-bit address and end up with a pointer to hell. :-) R. ~~~~~~~~~~~~~~~ Rich Siegel Staff Software Developer Symantec Corporation, Language Products Group Internet: siegel@endor.harvard.edu UUCP: ..harvard!endor!siegel "When someone who makes four hundred and fifty dollars an hour wants to tell you something for free, it's a good idea to listen." ~~~~~~~~~~~~~~~