On 11/10/2010 06:24 AM, Andy Pugh wrote:
> On 10 November 2010 10:49, Mark Wendt<[email protected]>  wrote:
>
>    
>> Almost.  In short circuit evaluations, " the second argument is only
>> executed or evaluated if the first argument does not suffice to
>> determine the value of the expression:
>>      
> My point was more to do with the question of what the second argument
> is. My suggested parenthesis was for the benefit of human readers to
> make sure that it was clear that what was being evaluated was
>
> if( new_in&&   (new_in != last_in ) )
>
> And not
>
> if( ( new_in&&  new_in)  != last_in )
>
> I don't think that my suggestion interferes with short-circuit
> evaluation at all.

Right.  But the second expression isn't read if the first one is false 
in an AND eval.  If the first eval is false, the entire statement is 
false in this case with the && operator, so the second expression is 
never evaluated.  You are evaluating two completely different things in 
those lines.  My point was that in your original reply, you mentioned 
that the != expression would be evaluated first, which is incorrect in a 
short circuit eval.  The first variable is always evaluated first, to 
determine whether or not to evaluate the second variable expression.  If 
new_in=0, new_in != last_in well never be evaluated.

Mark

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to