mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: Oliver Neukum <oliver@neukum.org>, linux-kernel@vger.kernel.org
Subject: Re: [patch]clarification of coding style regarding conditional statements with two branches
Date: Fri, 04 May 2007 18:16:46 +0200	[thread overview]
Message-ID: <m3hcqsbm35.fsf@maximus.localdomain> (raw)
In-Reply-To: <463B47AF.4010503@gmail.com> (Jiri Slaby's message of "Fri, 04 May 2007 16:48:15 +0200")

Jiri Slaby <jirislaby@gmail.com> writes:

> Why, what's wrong with
> if (condition) {
> 	do_this();
> 	do_that();
> } else
> 	otherwise();
>
> ? It's more readable/nicer in my eyes than

I think so. And it means less lines #.

>> +if (condition) {
>> +	do_this();
>> +	do_that();
>> +} else {
>> +	otherwise();
>> +}

Exception:

if (x) {
	if (y)
		foo1();
	else
		foo2();
} else
	bar();

The braces after if(x) are needed so nobody thinks it's:

if (x)
	if (y)
		foo1();
else
	foo2();
else
	bar();

-- 
Krzysztof Halasa

  parent reply	other threads:[~2007-05-04 16:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-04  7:26 Oliver Neukum
2007-05-04 14:48 ` Jiri Slaby
2007-05-04 15:29   ` Oliver Neukum
2007-05-04 16:24     ` Jiri Slaby
2007-05-04 16:16   ` Krzysztof Halasa [this message]
2007-05-04 21:16   ` Jan Engelhardt

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=m3hcqsbm35.fsf@maximus.localdomain \
    --to=khc@pm.waw.pl \
    --cc=jirislaby@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oliver@neukum.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

all inboxes | Powered by JetHome®