On 11/10/2010 06:58 AM, Andy Pugh wrote:
> On 10 November 2010 11:40, Mark Wendt<[email protected]>  wrote:
>
>    
>>   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.
>>      
> No, I said it had a higher precedence. That isn't quite the same thing.
>
> http://www.difranco.net/cop2220/op-prec.htm

I understand that, and typically, in the normal evaluation of variables, 
operators with a higher precedence typically get evaluated before 
operators with lower precedence.  What happens with short circuit evals, 
the first expression is evaluated first, then the operator is taken into 
account, and if it's an AND operator, and the first expression is met, 
then the second expression is evaluated.  If the first expression is not 
met, the second expression is never evaluated.  If the operator is an 
OR, the first expression is evaluated, the operator is taken into 
account, and then the second expression is evaluated, and if either 
expression is met, then the statement is considered true, and if neither 
expression is met, then the statement is false.  The behavior in short 
circuit evals is a little different than in other evals.  So in this 
case, with the simple if statement - if (new_in && new_in!=start_in), 
the precendence of the "!=" doesn't really matter that much.  If the 
second expression was more complex, with other operators, it would make 
a difference.

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