qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] Get coding style closer to the real world


From: Alexander Graf
Subject: [Qemu-devel] [PATCH] Get coding style closer to the real world
Date: Mon, 30 Nov 2009 22:55:55 +0100

Currently we have this stupid role of disallowing:

  if (r)
      break;

By disallowing this we clutter the code, making it less readable without
buying us anything. In fact, nobody actually sticks to this because it'd show
just how much bad taste the programmer doing this would have.

So IMHO we should change the coding style, so we can finally focus on
programming again and don't focus on useless coding style rules.

Signed-off-by: Alexander Graf <address@hidden>
---
 CODING_STYLE |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/CODING_STYLE b/CODING_STYLE
index a579cb1..806a1f8 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -51,11 +51,24 @@ QEMU coding style.
 
 4. Block structure
 
-Every indented statement is braced; even if the block contains just one
-statement.  The opening brace is on the line that contains the control
-flow statement that introduces the new block; the closing brace is on the
-same line as the else keyword, or on a line by itself if there is no else
-keyword.  Example:
+Usually indented statements are braced; even if the block contains just one
+statement. When braces reduce readability, they are not mandatory.
+
+Examples:
+
+    if (a == 5)
+        break;
+
+    if (b == 6) {
+        c = do_something();
+        /* Probably more code to be added here later */
+    }
+
+The opening brace is on the line that contains the control flow statement
+that introduces the new block; the closing brace is on the same line as
+the else keyword, or on a line by itself if there is no else keyword.
+
+Example:
 
     if (a == 5) {
         printf("a was 5.\n");
-- 
1.6.0.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]