From: Junio C Hamano <junkio@cox.net>
To: Michael Frank <mhf@linuxmail.org>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: PATCH, RFC: 2.6 Documentation/Codingstyle
Date: Thu, 12 Feb 2004 22:41:07 -0800 [thread overview]
Message-ID: <7voes31ny4.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <fa.fbh88ra.kn8094@ifi.uio.no> (Michael Frank's message of "Thu, 12 Feb 2004 22:08:33 GMT")
>>>>> "MF" == Michael Frank <mhf@linuxmail.org> writes:
MF> Comments and suggestions are appreciated.
Aside from the spelling & wording problems already commented on
by others (all of which I happen to agree),...
----------------------------------------------------------------
MF> This is a short document describing the preferred coding style for the
MF> linux kernel. Coding style is very personal, and I won't _force_ my
MF> views on anybody,...
MF> ... Anyway, here goes:
The above introductory paragraph needs to be rewritten if you
plan to start using CodingStyle document to record the developer
community consensus. The words "I" and "my" used here refer to
Linus and Linus only; IIRC, the coding style document originates
from an old posting by him to the l-k mailing list, and the
intent was to express view of Linus so that he does not have to
get involved in coding style flamewar on l-k list every time.
----------------------------------------------------------------
MF> +Note that perhaps the most terrible way to write code is to put multiple
MF> +statements onto a single line:
MF> + if (condition) do_this;
I do not think this particular one agrees with community
consensus yet. If "do_this" is short and sweet, I would not be
surprised if Linus said it is perfectly fine.
If the community indeed wants to ban a short single statement as
the body of an "if" statement, I would rather write the bad
example as this:
if (condition) never_do_this;
----------------------------------------------------------------
MF> +Lagging spaces are deprecated.
You probably meant "trailing spaces". In addition to that you
may also want to say something about <SP>s before <TAB>.
----------------------------------------------------------------
MF> +void fun(int a, int b, int c)
MF> +{
MF> + if (condition)
MF> + printk(KERN_WARNING "Warning this is a long printk with "
MF> + "3 parameters a: %u b: %u "
MF> + "c: %u \n", a, b, c);
MF> + else
MF> + next_statement;
MF> +}
This example violates indent by tab rule (notice spaces before "else").
----------------------------------------------------------------
MF> +Complex expressions are easier to understand and maintain when extra
MF> +parenthesis are used. Here is an extreme example
MF> +
MF> +x = (((a + (b * c)) & d) | e) // would work also without any parenthesis
I believe this goes against community consensus not to overuse
parentheses. Linus and others are also against "if ((a = b)) {
... }" (place extra parens around assignment expression used as
boolean), which is what GCC suggests (and which indeed is a
stupid suggestion).
----------------------------------------------------------------
MF> +Periods terminating kernel messages are deprecated
MF> +Usage of the apostrophe <'> in kernel messages is deprecated
I do not think encouraging bad spelling like above has reached
community consensus. Personally I do not like those sloppy
grammar ("donts" and missing period at the end of the sentence).
Encouraging people to be consistent is a good thing, but I do
not want to encourage people to be consistently sloppy.
next parent reply other threads:[~2004-02-13 6:41 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fa.fbh88ra.kn8094@ifi.uio.no>
2004-02-13 6:41 ` Junio C Hamano [this message]
2004-02-13 7:18 ` vda
2004-02-13 12:37 ` Maciej Zenczykowski
2004-02-13 13:57 ` vda
2004-02-12 22:15 Michael Frank
2004-02-12 23:20 ` Tim Bird
2004-02-12 23:46 ` Måns Rullgård
2004-02-13 0:19 ` Tim Hockin
2004-02-12 23:38 ` Randy.Dunlap
2004-02-13 1:50 ` Alex Goddard
2004-02-13 1:52 ` Maciej Zenczykowski
2004-02-13 0:13 ` viro
2004-02-13 1:12 ` J. Bruce Fields
2004-02-13 8:58 ` Giuliano Pochini
2004-02-13 9:10 ` Andrew Morton
2004-02-13 9:49 ` Michael Frank
2004-02-13 10:09 ` Nick Piggin
2004-02-13 10:50 ` Michael Frank
2004-02-18 7:39 ` Miles Bader
2004-02-13 12:44 ` viro
2004-02-13 9:19 ` David Weinehall
2004-02-13 11:42 ` Andries Brouwer
2004-02-13 12:13 ` Måns Rullgård
2004-02-13 12:42 ` Ed Tomlinson
2004-02-13 13:55 ` Giuliano Pochini
2004-02-13 14:35 ` Angelo Dell'Aera
2004-02-13 15:42 ` Giuliano Pochini
2004-02-13 15:48 ` Valdis.Kletnieks
2004-02-13 16:38 ` Angelo Dell'Aera
2004-02-13 17:03 ` Valdis.Kletnieks
2004-02-13 16:18 ` viro
2004-02-14 0:38 ` Kevin O'Connor
2004-02-14 0:56 ` Valdis.Kletnieks
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=7voes31ny4.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mhf@linuxmail.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®