• 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: Is the "id" type an immovable pointer? Or a movable handle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is the "id" type an immovable pointer? Or a movable handle


  • Subject: Re: Is the "id" type an immovable pointer? Or a movable handle
  • From: Joar Wingfors <email@hidden>
  • Date: Thu, 1 Feb 2007 00:56:08 +0100


On Feb 1, 2007, at 12:06 AM, Ken Tozier wrote:

I'm creating a bunch of NSInvocations and want to store them in a dictionary with a key that uniquely identifies the invocation target. I checked the "Objective C runtime" documentation and it doesn't appear that NSObjects have unique identifiers. I thought of adding a uuid property to a base class but uuids are 128 bytes so I was wondering, if objects don't move around in memory after allocation, I could just package the id to an NSNumber and use that for the key.

How many are "a bunch"? I can't really think of a typical scenario for using NSInvocations where the overhead of an equal number of UUIDs would matter.


That said, the address of an object doesn't change so you could wrap it in a NSValue (see: -[NSValue valueWithNonretainedObject:]) and use that if you would want to.
The problems that John mentioned are most likely not an issue in your case, as your invocation targets are of your own custom classes (my conclusion, as you mentioned the possibility of using a shared base class), and as such their create / copy behaviour are under your control.


j o a r


_______________________________________________

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


  • Follow-Ups:
    • Re: Is the "id" type an immovable pointer? Or a movable handle
      • From: Ken Tozier <email@hidden>
References: 
 >Is the "id" type an immovable pointer? Or a movable handle (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: Is the "id" type an immovable pointer? Or a movable handle
  • Next by Date: Re: Mixing network code with NSThread
  • Previous by thread: Re: Is the "id" type an immovable pointer? Or a movable handle
  • Next by thread: Re: Is the "id" type an immovable pointer? Or a movable handle
  • Index(es):
    • Date
    • Thread