• 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: NSNumber : method to return pointer to represented value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNumber : method to return pointer to represented value


  • Subject: Re: NSNumber : method to return pointer to represented value
  • From: Mike Kluev <email@hidden>
  • Date: Fri, 21 Feb 2014 21:37:32 +0000

> I require an pointer to the value represented by an NSNumber.
> ...
> I am using NSNumber instances in collections as keys.

i may not fully understand your question, but can you not just use
NSValue valueWithPointer as your collection keys?
or, if a number at all, the number matching the pointer representation:
[NSNumber numberWithLong:*(ptrdiff_t*)&pointer]
or a string in a similar manner: [NSString stringWithFormat:@"%p", pointer];

in my experience resorting to tricks of objc_getAssociatedObject is
asking for trouble (e.g. the associated object is not released with
zombies).

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


  • Prev by Date: Re: Display selectd sub-menuItem in NSPopUpButton
  • Next by Date: How to create a Tags selection field in a dialog
  • Previous by thread: Re: Display selectd sub-menuItem in NSPopUpButton
  • Next by thread: How to create a Tags selection field in a dialog
  • Index(es):
    • Date
    • Thread