Re: [Obj-C] if (self) vs. if (self != nil)
Re: [Obj-C] if (self) vs. if (self != nil)
- Subject: Re: [Obj-C] if (self) vs. if (self != nil)
- From: David Mirabito <email@hidden>
- Date: Sat, 25 Feb 2012 14:38:28 +0000
On 25/02/2012, at 2:29 PM, Scott Ribe wrote:
> On Feb 25, 2012, at 2:29 AM, David Mirabito wrote:
>
>> Not terribly helpful since the cocoa headers are what they are, but in other codebases I sneak around issue this by setting up the defines:
>>
>> #define FALSE 0
>> #define TRUE (!FALSE)
>>
>> Then something like "if (mybool == TRUE)" acts as expected across all non-zero values.
>
> (!0) evaluates to 1.
Ha! Well there you go. I guess I just saw that and accepted that it did what I looked like it was trying to do. Thanks for the correction.
That's my learned item for today, and sorry for the misinformation.
-David
_______________________________________________
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