Hi
In 4.2.3, the example given is
integer A, B, C, result;
result = A & (B | C);
I find this rather curious. In C like languages, evaluation short
circuits only apply to logical and (&&) and logical or (||), not to
bitwise and (&) or bitwise or (|). For instance, see sections 5.11 to
5.15 of ISO/IEC 14882: 2003 The C++ Standard.
For bitwise operators, there are two cases that could be short
circuited: bitwise and where the left operand is zero, and bitwise or
where the left operand is all ones.
My feeling is that this should be limited to logical operators, and that
the text should be more prescriptive. Just saying that it doesn't need
to be evaluated is not strong enough.
I.e., state explicitly that for a logical and, if the left operand is
zero then the right operand will not be evaluated. The same for a
logical or, if the left operand is non-zero.
Regards
Paul Floyd
-- Dr Paul Floyd Mentor Graphics Corporation -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Jan 27 03:42:17 2011
This archive was generated by hypermail 2.1.8 : Thu Jan 27 2011 - 03:42:27 PST