qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] CODING_STYLE: don't allow non-indented statements after if/else blocks
@ 2009-10-26  6:26 Aurelien Jarno
  2009-10-26 16:02 ` Blue Swirl
  0 siblings, 1 reply; 6+ messages in thread
From: Aurelien Jarno @ 2009-10-26  6:26 UTC (permalink / raw)
  To: qemu-devel

Rationale: The following code is difficult to read, but allowed by the
current coding style.

    if (a == 5) printf("a was 5.\n");
    else if (a == 6) printf("a was 6.\n");
    else printf("a was something else entirely.\n");

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 CODING_STYLE |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/CODING_STYLE b/CODING_STYLE
index a579cb1..3ffbc3d 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -51,11 +51,11 @@ 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:
+Every control flow statement is followed by a new indented and braced
+block; 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:
 
     if (a == 5) {
         printf("a was 5.\n");
-- 
1.6.1.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-26 21:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-26  6:26 [Qemu-devel] [PATCH] CODING_STYLE: don't allow non-indented statements after if/else blocks Aurelien Jarno
2009-10-26 16:02 ` Blue Swirl
2009-10-26 20:03   ` Aurelien Jarno
2009-10-26 20:20     ` Blue Swirl
2009-10-26 20:27       ` Aurelien Jarno
2009-10-26 21:16         ` Anthony Liguori

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).