On 11/10/2010 05:26 AM, Andy Pugh wrote:
>
>
<snippage>
>> The
>> statement "if(new_in&&  new_in != last_in)" kind of baffles me. "foo&&
>> foo" seems to be a programming trick called a short circuit?
>>      
> This works because != has a higher precedence than&&. This might be a
> sign of a programmer who implicitly knows this, or a programmer who
> got lucky. I would tend to prefer if(new_in&&  (new_in != last_in))
> because I don't know my operator precedences.
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: when the first argument of the 
|AND| function evaluates to |false|, the overall value must be |false|; 
and when the first argument of the |OR| function evaluates to |true|, 
the overall value must be |true"|. (Stolen shamelessly from the 
wiki...)  So, no real need for the second set of parentheses.

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