From: "Frans Meulenbroeks" <fransmeulenbroeks@gmail.com>
To: "Hans Verkuil" <hverkuil@xs4all.nl>
Cc: 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, 3 Sep 2008 08:57:35 +0200 [thread overview]
Message-ID: <ac9c93b10809022357l79d014d3ybb40271b2ae806fd@mail.gmail.com> (raw)
In-Reply-To: <200809030021.00122.hverkuil@xs4all.nl>
2008/9/3 Hans Verkuil <hverkuil@xs4all.nl>:
[...]
>
> "Don't put multiple statements on a single line unless you have
> something to hide:
>
> if (condition) do_this;
> do_something_everytime;
>
> Don't put multiple assignments on a single line either. Kernel coding
> style is super simple. Avoid tricky expressions."
>
> Does this mean:
>
> 1) Yes, after an 'if' you can put a single statement like this:
>
> if (a) b;
>
> 2) No, never use the 'if (a) b;' construction. Put 'b;' on the next line
> instead.
>
It means 2. The example is definitely tricky. At first sight the
indentation suggests that the 'do_something-everytime" belongs to the
if, so it might put people on the wrong foot.
Suggest the text to be revised though. Some of us are better in
English than others. No need to cause confusion...
just my two eurocents :-)
Frans
[...]
prev parent reply other threads:[~2008-09-03 6:57 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
2008-09-03 6:57 ` Frans Meulenbroeks [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=ac9c93b10809022357l79d014d3ybb40271b2ae806fd@mail.gmail.com \
--to=fransmeulenbroeks@gmail.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--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®