• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How can I get an instance specific identifier?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How can I get an instance specific identifier?


  • Subject: Re: How can I get an instance specific identifier?
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Fri, 24 Nov 2006 15:00:56 -0800


On Nov 24, 2006, at 13:31, Alan Smith wrote:

I want to use the memory location (eg 0x3a1c30) as the identifier for
the object. This would be for storing info in a dictionary, the memory
location would be used as the key. I just have no idea how to get the
memory location.

It doesn't have to be the memory location but it has to be specific to
the object and cannot be possible to have two with the same ID.

If you're using it as a key in a dictionary, you could also use the object itself if you implement copyWithZone: to return [self retain] and use NSObject's -hash and -isEqual: implementation. You can also use a CFMutableDictionary with pointer-equality callbacks, as long as you avoid toll-free bridging to add objects.


-- Adam

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >How can I get an instance specific identifier? (From: "Alan Smith" <email@hidden>)

  • Prev by Date: Re: Repositioning an NSTextFieldCell?
  • Next by Date: Re: Named images in linked frameworks
  • Previous by thread: Re: How can I get an instance specific identifier?
  • Next by thread: [SOLVED] How can I get an instance specific identifier?
  • Index(es):
    • Date
    • Thread