qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stuart Brady <sdbrady@ntlworld.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] CODING_STYLE: {} as in linux kernel
Date: Wed, 7 Oct 2009 18:09:52 +0100	[thread overview]
Message-ID: <20091007170952.GA938@miranda.arrow> (raw)
In-Reply-To: <4ACCABA0.8080001@redhat.com>

On Wed, Oct 07, 2009 at 04:54:24PM +0200, Gerd Hoffmann wrote:

> I somehow dislike the unneeded branches because it looks a bit 
> irritating to my eyes.

I felt the same way at first, but I've become used to them, now.

> They have advantages though.  Making patches more readable is one, as 
> kevin and the nice example above clearly points out ;)

Strictly, the example should be this:

-    if (a == 5)
+    if (a == 5) {
         printf("a was 5.\n");
-    else if (a == 6)
+    } else if (a == 6) {
         printf("a was 6.\n");
+        printf("multiply by 7 to get the answer.\n");
-    else
+    } else {
         printf("a was something else entirely.\n");
+    }

versus:

     if (a == 5) {
         printf("a was 5.\n");
     } else if (a == 6) {
         printf("a was 6.\n");
+        printf("multiply by 7 to get the answer.\n");
     } else {
         printf("a was something else entirely.\n");
     }

I know which one I prefer. :-)

Cheers,
-- 
Stuart Brady

      reply	other threads:[~2009-10-07 17:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06 19:01 [Qemu-devel] [PATCH] CODING_STYLE: {} as in linux kernel Michael S. Tsirkin
2009-10-06 21:08 ` Stefan Weil
2009-10-06 21:43   ` Anthony Liguori
2009-10-07 12:59     ` Markus Armbruster
2009-10-06 21:41 ` Stuart Brady
2009-10-07  9:11 ` Jamie Lokier
2009-10-07 14:12 ` Kevin Wolf
2009-10-07 14:54   ` Gerd Hoffmann
2009-10-07 17:09     ` Stuart Brady [this message]

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=20091007170952.GA938@miranda.arrow \
    --to=sdbrady@ntlworld.com \
    --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).