On Oct 16, 2013, at 22:44 , "Clark S. Cox III" <clarkc...@gmail.com> wrote:
> > On Oct 16, 2013, at 21:44, Rick Mann <rm...@latencyzero.com> wrote: > >> >> On Oct 16, 2013, at 21:16 , Keary Suska <xcode-us...@esoteritech.com> 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 > clarkc...@gmail.com > > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > 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 rm...@latencyzero.com -- Rick
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com