On Mon, Feb 16, 2009 at 12:54 PM, Timo Kreuzer <timo.kreuzer(a)web.de> wrote:
Zachary Gorden schrieb:
I agree with the requirement for the parenthesis,
simply because it helps
separate the various conditions that are being tested for. Even looking at
The conditions are clearly seperated by || or by &&. It should be
instantly clear that the comparison is higher than || and && in the
order of operations.
Something like "if (a == (b || c) > d)" wouldn't make sense anyway.
Do not mess this up with bracing things like
if ((a == 0 || a > 2) && b < 0)
Although the braces are not needed, it makes sense to set them.
() -> parentheses
[] -> brackets
{} -> braces
The parentheses are not needed? You better check your C book for
operator precedence. && has higher precedence than ||, so in this
case the parentheses are needed. This is also why using parentheses
is a good idea, because you never know if the original author has any
idea about operator precedence. The use of parentheses makes the
original intention clear to other authors.
--
James Hawkins