• 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
Type of @true in Obj-C vs Obj-C++
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Type of @true in Obj-C vs Obj-C++


  • Subject: Type of @true in Obj-C vs Obj-C++
  • From: Rick Mann <email@hidden>
  • Date: Tue, 09 Jul 2013 00:29:25 -0700

Well, in tracking down a problem with Security.framework, I discovered something today. One of these things is not like the other, unless you're translating Objective-C++:

{
	id cfTrue = (__bridge id) kCFBooleanTrue;
	id atTrue = @true;
	id atYes = @YES;

	NSLog(@"kCFBooleanTrue class: %@", NSStringFromClass([cfTrue class]));
	NSLog(@"@true class:          %@", NSStringFromClass([atTrue class]));
	NSLog(@"@YES class:           %@", NSStringFromClass([atYes class]));
}

In Objective-C:

2013-07-09 00:29:14.074 TestSec2[30025:c07] kCFBooleanTrue class: __NSCFBoolean
2013-07-09 00:29:14.075 TestSec2[30025:c07] @true class:          __NSCFNumber
2013-07-09 00:29:14.075 TestSec2[30025:c07] @YES class:           __NSCFBoolean


In Objective-C++:

2013-07-09 00:25:49.040 TestSec2[29983:c07] kCFBooleanTrue class: __NSCFBoolean
2013-07-09 00:25:49.041 TestSec2[29983:c07] @true class:          __NSCFBoolean
2013-07-09 00:25:49.041 TestSec2[29983:c07] @YES class:           __NSCFBoolean

Is there a switch to pass to clang to make it always treat true & @true the way it does in C++?


--
Rick




 _______________________________________________
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: Type of @true in Obj-C vs Obj-C++
      • From: Jean-Daniel Dupas <email@hidden>
  • Prev by Date: Re: Create Universal Binary with One Architecture?
  • Next by Date: Re: Type of @true in Obj-C vs Obj-C++
  • Previous by thread: Re: Create Universal Binary with One Architecture?
  • Next by thread: Re: Type of @true in Obj-C vs Obj-C++
  • Index(es):
    • Date
    • Thread