Re: Question Regarding the Memory Address of Objects
Re: Question Regarding the Memory Address of Objects
- Subject: Re: Question Regarding the Memory Address of Objects
- From: "Michael Ash" <email@hidden>
- Date: Thu, 18 Dec 2008 17:05:49 -0500
On Thu, Dec 18, 2008 at 3:53 PM, Carter R. Harrison
<email@hidden> wrote:
> Once again you have saved me from pulling my hair out. Thank you once again
> for your assistance. For the rest of the folks on the thread the solution
> was to remove the "&" from the front of all my pointers.
I'd suggest that your basic approach isn't really very good. For one
thing, it'll break on 64-bit (%x is an int, which is still 32-bit).
Even if you fix that, generating a string with a pointer value is a
pretty baroque way to do what you're doing.
If you can require 10.5, simply use NSMapTable. It works like an
NSDictionary but can take arbitrary (non-NSCopying) pointers as keys,
when properly configured.
If you must run on 10.4 or below, either use CFDictionary with
customized callbacks (and *don't* use the toll-free bridging support
if you do, TFB'd CFDictionaries will copy their keys even if you tell
them not to) or use [NSValue valueWithPointer:] to generate keys.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden