• 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: Graham Cox <email@hidden>
  • Date: Mon, 24 Feb 2014 00:15:01 +1100

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.


> The second provides some support for the idea that the NSNumber private subclasses do indeed return an invariant -objCType.

Maybe they do - today. But they are not required to do so, and have not done so in the past.

How many types do you need to support anyway? What about my string idea? Either that or a custom class would actually require very little effort - probably less than the typing in this discussion so far anyway!

--Graham



_______________________________________________

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


  • Follow-Ups:
    • Re: NSNumber : method to return pointer to represented value
      • From: "email@hidden" <email@hidden>
    • Re: NSNumber : method to return pointer to represented value
      • From: Uli Kusterer <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>)

  • Prev by Date: Re: NSNumber : method to return pointer to represented value
  • Next by Date: Re: NSNumber : method to return pointer to represented value
  • 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