public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-kernel@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Teemu Likonen <tlikonen@iki.fi>, Jiri Kosina <jkosina@suse.cz>,
	Dan Carpenter <error27@gmail.com>,
	Martin Olsson <martin@minimum.se>,
	linux-doc@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH RFC] Codingstyle: allow omitting braces for all single statement branches
Date: Thu, 26 Nov 2009 15:52:59 +0100	[thread overview]
Message-ID: <1259247179.31676.112.camel@laptop> (raw)
In-Reply-To: <1259227618-1466-1-git-send-email-u.kleine-koenig@pengutronix.de>

On Thu, 2009-11-26 at 10:26 +0100, Uwe Kleine-König wrote:

> -This does not apply if one branch of a conditional statement is a single
> -statement. Use braces in both branches.
> -
> -if (condition) {
> -	do_this();
> -	do_that();
> -} else {
> -	otherwise();
> -}
> +If not all branches of a conditional statement are single statements you might
> +use braces for both branches.
> +
> +	if (condition) {
> +		do_this();
> +		do_that();
> +	} else
> +		otherwise();
> +
> +or
> +
> +	if (condition) {
> +		do_this();
> +		do_that();
> +	} else {
> +		otherwise();
> +	}
>  
>  		3.1:  Spaces

Andrew recently objected to this pattern, and I tend to agree with him
although I might be guilty of a few such cases myself.


  reply	other threads:[~2009-11-26 14:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26  9:26 [PATCH RFC] Codingstyle: allow omitting braces for all single statement branches Uwe Kleine-König
2009-11-26 14:52 ` Peter Zijlstra [this message]
2009-11-26 16:11 ` Stefan Richter

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=1259247179.31676.112.camel@laptop \
    --to=peterz@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=error27@gmail.com \
    --cc=gitster@pobox.com \
    --cc=jkosina@suse.cz \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin@minimum.se \
    --cc=rdunlap@xenotime.net \
    --cc=tlikonen@iki.fi \
    --cc=u.kleine-koenig@pengutronix.de \
    /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