• 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: Uli Kusterer <email@hidden>
  • Date: Sun, 23 Feb 2014 18:01:38 +0100

On 23 Feb 2014, at 14:15, Graham Cox <email@hidden> wrote:
> On 23 Feb 2014, at 11:08 pm, email@hidden wrote:
>
>>> 1(int) and 1(float) can be represented by the same NSNumber object perfectly legally.
>> Is that true?
>
> I said "can be", not "is". Certainly my observation in the past was that NSNumber stored, as an int, a float that could be represented purely by an int. This was probably in the 10.4/10.5 timeframe or so, which caused me to create a class that stored the original data type as well as a value. It may be that the implementation has changed since then - certainly tagged pointers weren't used - and it's actually always a separate object now where -objCType doesn't ever change. But that just shows that the implementation can change in a way that would affect your scheme, and could again.

 Graham is right. Similarly, in ye olde days, NSNumber numberWithBool: used to return NSNumbers containing the int 1 or 0. These days, they’re short-circuited to actually return kCFBooleanTrue and kCFBooleanFalse. It has changed, and might change again.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


_______________________________________________

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


References: 
 >NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Fritz Anderson <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Ken Thomases <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Ken Thomases <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Graham Cox <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Graham Cox <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Disabling screen capture
  • Next by Date: Re: Disabling screen capture
  • Previous by thread: Re: NSNumber : method to return pointer to represented value
  • Next by thread: Re: NSNumber : method to return pointer to represented value
  • Index(es):
    • Date
    • Thread