qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Get coding style closer to the real world
Date: Mon, 30 Nov 2009 22:55:55 +0100	[thread overview]
Message-ID: <1259618155-4217-1-git-send-email-agraf@suse.de> (raw)

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 <agraf@suse.de>
---
 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	other threads:[~2009-11-30 21:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 21:55 Alexander Graf [this message]
2009-12-01  9:39 ` [Qemu-devel] [PATCH] Get coding style closer to the real world Markus Armbruster
2009-12-04 17:47 ` Paul Brook
2009-12-04 22:30   ` Anthony Liguori
2009-12-05 17:33     ` Avi Kivity
2009-12-04 23:47   ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259618155-4217-1-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).