Re: Unnecessary Boolean Warning
Re: Unnecessary Boolean Warning
- Subject: Re: Unnecessary Boolean Warning
- From: Jean-Daniel Dupas <email@hidden>
- Date: Wed, 03 Aug 2011 17:52:18 +0200
Le 3 août 2011 à 16:40, Thomas Davie a écrit :
>
> On 3 Aug 2011, at 15:15, Scott Ribe wrote:
>
>> On Aug 3, 2011, at 7:54 AM, Thomas Davie wrote:
>>
>>> Not really – both C ands are the same and… they're just operating on different representations of booleans.
>>
>> No, they're not the same at all. One is a bitwise operation on binary ints.
>
> Yes – it performs the logical and operation on booleans represented by bits (lots of booleans at once in this instance). The other performs the same logical and operation on booleans represented by entire ints. Same op, different representations.
>
They are 2 different operators.
One important difference for instance is that if you write if (a() & b()), both a() and b() will always be executed, while if you write if (a() && b()), b() will be executed only if a() is true.
-- Jean-Daniel
_______________________________________________
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