[lkml]   [2006]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH/v2] CodingStyle updates
On 12/15/06, Pavel Machek <> wrote:
> On Fri 2006-12-15 08:52:22, Scott Preece wrote
> >
> > I think the mistake illuminates why parentheses should be the rule. If
> > you're thinking about using spacing to convey grouping, use
> > parentheses instead...
> Not in simple cases.
> 3*i + 2*j should be writen like that. Not like
> (3 * i) + (2 * j)

Actually, my preference would be to use the parentheses AND drop the
spaces: (3*i)+(2*j) . But, existing kernel code seems to prefer just
using spaces and adding parentheses when it gets complicated. Note
that the mistake in your example was in a relatively simple

I think the unary operator case is a little different - it's not so
much to make precedence clear as just to help the reader chunk the
pieces of the string more naturally (at least, it's more natural to
anyone who's ever done anything object-oriented). I agree that your
spacing example, above, also helps that way, but it seems better to do
it in a way that's meaningful o the compiler as well as to the reader.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-12-15 17:19    [W:0.058 / U:2.840 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site