• 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: Danger: @true and @false aren't considered booleans
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Danger: @true and @false aren't considered booleans


  • Subject: Re: Danger: @true and @false aren't considered booleans
  • From: Alexander von Below <email@hidden>
  • Date: Mon, 20 Aug 2012 00:12:12 +0200

Am 19.08.2012 um 23:59 schrieb Jens Alfke <email@hidden>:

>> Note: it's not sufficient to check whether a NSNumber instance is a boolean by comparing the *pointer* against kCFBooleanTrue respectively kCFBooleanFalse.
>
> Nevertheless, this appears to be what JSNSONSerialization does:
> 	[NSNumber numberWithChar: 1] —> "1"
> 	[NSNumber numberWithBOOL: YES] —> "true"
> even though there is no difference I can tell between the two NSNumber instances (both have encoding "c" and value 1.)

I am not sure if I am answering the question, but the safest way I know of to check if the NSNumber object is an CFBooleanRef is this:

CFGetTypeID(numberObject) == CFBooleanGetTypeID()

(and as you said, it is hard to imagine that being something else than kCFBooleanTrue or kCFBooleanFalse

Alex
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Danger: @true and @false aren't considered booleans
      • From: Quincey Morris <email@hidden>
References: 
 >Danger: @true and @false aren't considered booleans (From: Jens Alfke <email@hidden>)
 >Re: Danger: @true and @false aren't considered booleans (From: Andreas Grosam <email@hidden>)
 >Re: Danger: @true and @false aren't considered booleans (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Danger: @true and @false aren't considered booleans
  • Next by Date: Re: Danger: @true and @false aren't considered booleans
  • Previous by thread: Re: Danger: @true and @false aren't considered booleans
  • Next by thread: Re: Danger: @true and @false aren't considered booleans
  • Index(es):
    • Date
    • Thread