mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Halasa <khc@pm.waw.pl>
To: Roland Dreier <rdreier@cisco.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>,
	LKML <linux-kernel@vger.kernel.org>,
	"v4l-dvb maintainer list" <v4l-dvb-maintainer@linuxtv.org>
Subject: Re: CodingStyle question: multiple statements on a single line
Date: Wed, 03 Sep 2008 14:15:44 +0200	[thread overview]
Message-ID: <m3tzcxl91r.fsf@maximus.localdomain> (raw)
In-Reply-To: <ada7i9ufa7x.fsf@cisco.com> (Roland Dreier's message of "Tue\, 02 Sep 2008 15\:34\:42 -0700")

Roland Dreier <rdreier@cisco.com> writes:

> This is correct.  Always write simple if statements as
>
> 	if (a)
> 		b;

The CodingStyle should never say "never" (nor "always").

Consider:

	if (a)		b;
	else if (c)	d;
	else if (e)	f;
	etc.

If the list is long and expressions simple this is IMHO much more
readable. The same with

	switch (a) {
	case b: c; break;
	case d: e; break;
	and so on.

> Keep in mind that common sense always trumps any mechanical rule.

Precisely.
-- 
Krzysztof Halasa

  parent reply	other threads:[~2008-09-03 12:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-02 22:20 Hans Verkuil
2008-09-02 22:34 ` Roland Dreier
2008-09-02 23:50   ` Mike Isely
2008-09-03  0:23     ` Randy Dunlap
2008-09-03 12:19     ` Krzysztof Halasa
2008-09-03 18:38     ` Roland Dreier
2008-09-03 20:22       ` Lennart Sorensen
2008-09-03 12:15   ` Krzysztof Halasa [this message]
2008-09-03  6:57 ` Frans Meulenbroeks

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=m3tzcxl91r.fsf@maximus.localdomain \
    --to=khc@pm.waw.pl \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=v4l-dvb-maintainer@linuxtv.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®