On Jan 29, 8:34am, Brian Somers wrote: } Subject: Re: btokup().. patch to STYLE(9) (fwd) } } My argument is that this sort of thing gets out of hand. I've seen } things such as } } if (((a == b) || (c == d))) } } where a, b, c & d are just simple variables - there are so many } redundant brackets that you have to double-check that there isn't } some weird grouping....
You can pretty clearly dump the outer parens, since it makes no sense to write "(expression)" instead of "expression". In general, "a OP b" should not be parenthesized if both "a" and "b" are atoms unless the context requires it. In general my preferred style doesn't use parentheses in expressions using "+-*/" according to their naturual precedence rules. I might drop the whitespace around "*", just like you'd write "2n" in mathematics. Likewise, I don't use parentheses in logical expressions or bitwise expressions where the terms are atoms. Expressions used as terms in logical expressions or comparision expressions might be parenthesized if they are complicated so I can find the extent of the expression by using '%' in vi. I always parenthesize the interfaces between bitwise and other expressions, since K&R admits that C botched the precedence of the bitwise operators and this seems to be one common place for bugs to occur. In general, I always parenthesize non-atomic arguments to the shift and ternary operators. To Unsubscribe: send mail to majord...@freebsd.org with "unsubscribe freebsd-current" in the body of the message