Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!julius.cs.uiuc.edu!apple!stevec From: stevec@Apple.COM (Steve Christensen) Newsgroups: comp.sys.mac.programmer Subject: Re: StripAddress() question Message-ID: <46697@apple.Apple.COM> Date: 19 Nov 90 17:51:42 GMT References: <90323.102417CXT105@psuvm.psu.edu> Organization: Apple Computer Inc., Cupertino, CA Lines: 32 CXT105@psuvm.psu.edu (Christopher Tate) writes: >Do I need to call StripAddress() in the following situation? Here's the >relevant code: > >Handle myHand; >unsigned char *myPtr; > >myHand = NewHandle(AMOUNT); >HLock(myHand); >myPtr = StripAddress(*myHand); /* <-- do I need to do this? */ >/* Now, put stuff into the block, using and incrementing myPtr */ > >Do I need to call StripAddress(*myHand) to make sure I get a valid >pointer into the block? I *think* I do, because the master pointer >might have strange stuff in it, but I'm not sure, and the tech note >isn't too clear on this.... No, the pointer is valid without calling StripAddress(). In 24-bit addressing mode (non-A/UX, non-VM), the upper 8 bits of a pointer can contain some bits used by the Memory Manager, but they're ignored for address purposes. Generally you only need to call StripAddress if you need to compare two addresses, since then the full 32 bits is used... steve -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ whoami? Steve Christensen snail: Apple Computer, 20525 Mariani Ave, MS-81CS, Cupertino, CA 95035 internet: stevec@apple.com AppleLink: stevec CompuServe: 76174,1712