From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NFEAZ-0001xu-IK for qemu-devel@nongnu.org; Mon, 30 Nov 2009 16:52:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NFEAV-0001vb-60 for qemu-devel@nongnu.org; Mon, 30 Nov 2009 16:52:31 -0500 Received: from [199.232.76.173] (port=56060 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NFEAU-0001vV-QV for qemu-devel@nongnu.org; Mon, 30 Nov 2009 16:52:26 -0500 Received: from cantor.suse.de ([195.135.220.2]:34758 helo=mx1.suse.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NFEAU-0007j4-9W for qemu-devel@nongnu.org; Mon, 30 Nov 2009 16:52:26 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 3D5D45362F for ; Mon, 30 Nov 2009 22:52:24 +0100 (CET) From: Alexander Graf Date: Mon, 30 Nov 2009 22:55:55 +0100 Message-Id: <1259618155-4217-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH] Get coding style closer to the real world List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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