Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!think!snorkelwacker!apple!archer!dwb From: dwb@archer.apple.com (David W. Berry) Newsgroups: comp.sys.mac.programmer Subject: Re: StripAddress... Message-ID: <6521@internal.Apple.COM> Date: 5 Feb 90 21:53:37 GMT References: <1990Feb2.010425.28126@oracle.com> Sender: usenet@Apple.COM Organization: Apple Computer Lines: 44 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... ] > > struct foo { > int a, b, c; > } **bar; > bar = (struct foo **) NewHandle(sizeof(struct foo)); > >Now, when I say "(*bar)->a" is this 32-bit clean? For this example Yes. If the flag bits are in the upper byte, the memory mapping hardware will be set to ignore the upper byte. If full 32 bit addresses are being used, the flags will be kept somewhere other than the upper byte. The primary things to remember to be 32 bit clean are: 1. Don't use bset/bclr to change or access flag bytes. Use HLock, HGetState, etc. 2. Don't fake handles. A handle and an &Pointer aren't the same thing. If you want to include your custom ?DEF in line in your program the following routine is real handy: ProcHandle ProcToHandle(ProcPtr proc) { struct ProcJmp { short jmp; ProcPtr addr; } **hand; hand = (struct ProcJmp **) NewHandle(sizeof(**hand)); (**hand).jmp = 0x4ef9; (**hand).addr = StripAddress(proc); /* excessive paranoia */ return (ProcHandle) hand; } 3. Don't try to walk the zone. The zone format is subject to change. If it changes you'll likely blow up. 4. Use GetWVariant and GetCVariant instead of using the upper byte of the definition routine. If you have to set the variant be real careful, remember to check for an auxilliary record and change the variant there if it exists. If not set it in the upper byte.