On Oct 16, 2013, at 22:44 , "Clark S. Cox III" <[email protected]> wrote:

> 
> On Oct 16, 2013, at 21:44, Rick Mann <[email protected]> wrote:
> 
>> 
>> On Oct 16, 2013, at 21:16 , Keary Suska <[email protected]> wrote:
>> 
>>> "if (self.active)" should never flag a warning, because it is not only 
>>> perfectly legal but also not in any way an odd construct. The compiler 
>>> can't know that you might not be testing for a nil value, for instance. 
>>> Some advocate always having an explicit r-value, e.g. "if (self.active != 
>>> nil)", which always makes the intention clear, but it is only a convention 
>>> one could use to avoid ambiguity. In your case, this convention might have 
>>> helped since implicit pointer conversion is usually flagged.
>> 
>> I realize this, which is why I asked for a warning. clang is smart enough to 
>> recognize (I think) if something is actually its BOOL type, and I'd settle 
>> for this only working in Objective-C++. Maybe that's why it didn't work.
>> 
>> I never use the perfectly legitimate but IMO lazy test for nil; I always 
>> make it explicit, and I accept this requirement when turning on the warning. 
>> Forcing that is much better than missing things like the one I missed.
> 
> Note that it is more complex than just looking for a boolean type. Remember 
> that operators such as “<“, “==“ or “!” return int, and not _Bool, so 
> something like this:
> 
>> if (self.active != nil)
> 
> 
> is an if statement using a non-boolean type (because "self.active != nil” is 
> an “int", not “_Bool”, “BOOL" or “bool").

Oh, I had assumed those operators returned a bool type (at least in C++).

> 
> Either way, I would recommend filing a bug asking for your warning.

Will do.

> 
> -- 
> Clark Smith Cox III
> [email protected]
> 
> 
> _______________________________________________
> 
> Cocoa-dev mailing list ([email protected])
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com
> 
> This email sent to [email protected]


-- 
Rick



Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to