Am Freitag, 20. April 2007 11:36 schrieb Tilman Schmidt:
> [Sorry for partial mail, unfamiliar mail client]
> 
> On Thu, 19 Apr 2007 22:01:46 -0700, "Andrew Morton"
> <[EMAIL PROTECTED]> said:
> > Which rules?  afacit usb is a rule-free zone, but most of the rest of the
> > kernel will put braces around both legs of an if-else if either leg
> > requires braces.  However lots of developers seem to delight in avoiding
> > learning that.
> 
> I beg to differ. I have already been rebuked for the unnecessary braces
> in
> sth like:
> 
>         if (cond) {
>                 stmt1;
>                 stmt2;
>         } else {
>                 stmt3;
>         }
> 
> as not confirming to CodingStyle. So that last phrase should rather
> read:
> "Lots of developers seem to delight in avoiding rebukes."

Such silliness has to end.

        Regards
                Oliver

Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
-----

--- a/Documentation/CodingStyle 2007-04-20 13:08:17.000000000 +0200
+++ b/Documentation/CodingStyle 2007-04-20 13:16:14.000000000 +0200
@@ -160,6 +160,21 @@
 25-line terminal screens here), you have more empty lines to put
 comments on.
 
+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();
+}
+
                3.1:  Spaces
 
 Linux kernel style for use of spaces depends (mostly) on

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to