Re: !foo vs foo == nil
Re: !foo vs foo == nil
- Subject: Re: !foo vs foo == nil
- From: Thomas Engelmeier <email@hidden>
- Date: Thu, 21 Aug 2008 12:25:36 +0200
Am 21.08.2008 um 11:04 schrieb Negm-Awad Amin:
Sometimes you see in source code something like this:
if( booleanVarOrExpression == YES )
(I think, Rentzsch does it that way, IIRC) and Ithink, that this is
simply correct.
Oh, that is another discussion.
Bool != Boolean != bool, and sometimes that can introduce subtle
errors if it's not only used to evaluate logical statements but by
comparing values, especially to "YES", true and "TRUE".
In an large C++ Cross-Platform project I spotted some subtle problems,
IIRC from assignment of an bool to an Boolean for an API that
evaluated the values by comparison to "TRUE" or some code assigned it
to ints, giving different values for true (1 vs. 0xFF vs. 0xFFFFFFFF).
I don't know any more, fixed it, was glad my own coding practices
don't leave room for that problems, moved on ;-)...
Regards,
Tom_E
_______________________________________________
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