qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: Avi Kivity <avi@redhat.com>
Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] CODING_STYLE: explicitly allow braceless 'else if'
Date: Fri, 29 Jul 2011 09:37:29 -0500	[thread overview]
Message-ID: <4E32C5A9.6080106@codemonkey.ws> (raw)
In-Reply-To: <1311609353-28365-1-git-send-email-avi@redhat.com>

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<avi@redhat.com>

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:
>

      parent reply	other threads:[~2011-07-29 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-25 15:55 [Qemu-devel] [PATCH] CODING_STYLE: explicitly allow braceless 'else if' Avi Kivity
2011-07-25 17:00 ` Blue Swirl
2011-07-26  6:02   ` Stefan Hajnoczi
2011-07-29 14:37 ` Anthony Liguori [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E32C5A9.6080106@codemonkey.ws \
    --to=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).