[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070508222540.GG8753@csclub.uwaterloo.ca>
Date: Tue, 8 May 2007 18:25:40 -0400
From: lsorense@...lub.uwaterloo.ca (Lennart Sorensen)
To: Jeff Garzik <jeff@...zik.org>
Cc: Randy Dunlap <randy.dunlap@...cle.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: CodingStyle: start flamewar about use of braces
On Tue, May 08, 2007 at 05:19:45PM -0400, Jeff Garzik wrote:
> >>+Do not unnecessarily use braces where a single statement will do.
> >>+
> >>+if (condition)
> >>+ action();
> >>+
> >>+This does not apply if one branch of a conditional statement is a single
> >>+statement. Use braces in both branches.
> >>+
> >>+if (condition) {
> >>+ do_this();
> >>+ do_that();
> >>+} else {
> >>+ otherwise();
> >>+}
>
> If anyone tries to add braces to my code's 'else' statements where they
> are not required, that patch will get NAK'd in a heartbeat.
Oh isn't coding style fun. I personally hate code that doesn't ALWAYS
have the braces everywhere since it makes adding a print statement
or other debuging to the condition such a pain since you then have to
add braces to the condition to avoid breaking the code just to insert
a print statement. It is one of the few things I disagree with in the
linux kernel coding style.
--
Len Sorensen
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists