qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] CODING_STYLE: {} as in linux kernel


From: Stuart Brady
Subject: Re: [Qemu-devel] [PATCH] CODING_STYLE: {} as in linux kernel
Date: Wed, 7 Oct 2009 18:09:52 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

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 via email to

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