Re: Logical and - second operator evaluated?
Re: Logical and - second operator evaluated?
- Subject: Re: Logical and - second operator evaluated?
- From: Shawn Erickson <email@hidden>
- Date: Sun, 1 Mar 2009 12:27:09 -0800
On Sun, Mar 1, 2009 at 12:06 PM, Martijn van Exel <email@hidden> wrote:
> Hi devs,
>
> I can't seem to get away with
> if(timer!=nil && [timer isValid]) [timer invalidate];
> if the timer object does not exist.
> I'm not used to the second operator of the && even being evaluated if the
> first one evaluates false (Java, .NET). This is not the case in (Obj)C?
Objective-C is a simple super set of C and C follows (progenitor in a
way) what you expect from Java / .NET.
What makes you believe this isn't taking place? What is the issue you
are seeing?
Anyway a message sent to nil is a no-op so you don't need to check for
the timer being nil. Also I am fairly sure invalidating an already
invalidated timer is simply ignored.
-Shawn
_______________________________________________
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