Type of @true in Obj-C vs Obj-C++
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