From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:39834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlNVq-0000xH-Ll for qemu-devel@nongnu.org; Mon, 25 Jul 2011 11:56:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlNVp-0000vc-TT for qemu-devel@nongnu.org; Mon, 25 Jul 2011 11:56:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21119) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlNVp-0000vX-MS for qemu-devel@nongnu.org; Mon, 25 Jul 2011 11:56:09 -0400 From: Avi Kivity Date: Mon, 25 Jul 2011 18:55:53 +0300 Message-Id: <1311609353-28365-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH] CODING_STYLE: explicitly allow braceless 'else if' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , av1474@comtv.ru, blauwirbel@gmail.com, qemu-devel@nongnu.org It's already allowed by the example; there are about 1800 instances in the tree; and disallowing it would lead to if (a) { ... } else { if (b) { ... } else { if (c) { ... } else { if (d) { ... } else { ... } } } } instead of if (a) { ... } else if (b) { ... } else if (c) { ... } else if (d) { ... } else { ... } which is more readable. Signed-off-by: Avi Kivity --- CODING_STYLE | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/CODING_STYLE b/CODING_STYLE index 5ecfa22..6e61c49 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -68,6 +68,10 @@ keyword. Example: printf("a was something else entirely.\n"); } +Note that 'else if' is considered a single statement; otherwise a long if/ +else if/else if/.../else sequence would need an indent for every else +statement. + An exception is the opening brace for a function; for reasons of tradition and clarity it comes on a line by itself: -- 1.7.5.3