From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmoC0-0004Qh-46 for qemu-devel@nongnu.org; Fri, 29 Jul 2011 10:37:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QmoBw-0006VY-3d for qemu-devel@nongnu.org; Fri, 29 Jul 2011 10:37:36 -0400 Received: from mail-gy0-f173.google.com ([209.85.160.173]:51381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QmoBv-0006VR-Uk for qemu-devel@nongnu.org; Fri, 29 Jul 2011 10:37:32 -0400 Received: by gyg8 with SMTP id 8so3069983gyg.4 for ; Fri, 29 Jul 2011 07:37:31 -0700 (PDT) Message-ID: <4E32C5A9.6080106@codemonkey.ws> Date: Fri, 29 Jul 2011 09:37:29 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1311609353-28365-1-git-send-email-avi@redhat.com> In-Reply-To: <1311609353-28365-1-git-send-email-avi@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] CODING_STYLE: explicitly allow braceless 'else if' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org On 07/25/2011 10:55 AM, Avi Kivity wrote: > 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 Applied. Thanks. Regards, Anthony Liguori > --- > 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: >