From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Jesper Juhl <juhl-lkml@dif.dk>
Cc: Roland Dreier <roland@topspin.com>,
Paulo Marques <pmarques@grupopie.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: RFC: turn kmalloc+memset(,0,) into kcalloc
Date: Wed, 6 Apr 2005 13:28:38 +0200 [thread overview]
Message-ID: <20050406112837.GC7031@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <Pine.LNX.4.62.0504052148480.2444@dragon.hyggekrogen.localhost>
On Tue, 5 April 2005 22:01:49 +0200, Jesper Juhl wrote:
> On Tue, 5 Apr 2005, Roland Dreier wrote:
>
> > > or simply
> > > if (!(ptr = kcalloc(n, size, ...)))
> > > goto out;
> > > and save an additional line of screen realestate while you are at it...
> >
> > No, please don't do that. The general kernel style is to avoid
> > assignments within conditionals.
> >
> It may be the prefered style to avoid assignments in conditionals, but in
> that case we have a lot of cleanup to do. What I wrote above is quite
> common in the current tree - a simple egrep -r "if\ *\(\!\(.+=" * in
> 2.6.12-rc2-mm1 will find you somewhere between 1000 and 2000 cases
> scattered all over the tree.
>
> Personally I don't see why thy should not be used. They are short, not any
> harder to read (IMHO), save screen space & are quite common in userspace
> code as well (so people should be used to seeing them).
>
> If such statements are generally frawned upon then I'd suggest an addition
> be made to Documentation/CodingStyle mentioning that fact, and I wonder if
> patches to clean up current users would be welcome?
I _do_ change them whenever they occur in code I maintain. And each
time, it is an improvement.
o Functional code always has the same indentation. I can mentally
ignore the error path by ignoring all indented code. Getting a
quick overview is quite nice.
o Rather often, your preferred variant violates the 80 columns rule.
If I need the line break anyway,...
o Keeping condition and functional code seperate avoids the Lisp-style
bracket maze. Some editors can help you here, but not needing any
help would be even better, no?
Jörn
--
Mundie uses a textbook tactic of manipulation: start with some
reasonable talk, and lead the audience to an unreasonable conclusion.
-- Bruce Perens
next prev parent reply other threads:[~2005-04-06 11:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-05 16:26 Paulo Marques
2005-04-05 18:00 ` Jörn Engel
2005-04-06 12:09 ` Denis Vlasenko
2005-04-05 18:54 ` Jesper Juhl
2005-04-05 19:20 ` Roland Dreier
2005-04-05 20:01 ` Jesper Juhl
2005-04-06 11:28 ` Jörn Engel [this message]
2005-04-06 12:15 ` Paulo Marques
2005-04-06 13:10 ` Pekka Enberg
2005-04-06 15:50 ` Paulo Marques
2005-04-07 23:54 ` Kyle Moffett
2005-04-09 2:11 ` Jesper Juhl
2005-04-07 21:47 ` Adrian Bunk
2005-04-08 12:38 ` Paulo Marques
2005-04-08 13:00 ` Adrian Bunk
2005-04-08 13:20 ` Jörn Engel
2005-04-08 13:29 ` Adrian Bunk
2005-04-08 16:24 ` Paulo Marques
2005-04-08 19:43 ` Adrian Bunk
2005-04-08 19:49 ` Randy.Dunlap
2005-04-08 13:00 ` stack checking (was: Re: RFC: turn kmalloc+memset(,0,) into kcalloc) Jörn Engel
2005-04-09 14:19 ` RFC: turn kmalloc+memset(,0,) into kcalloc Paul Jackson
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=20050406112837.GC7031@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=juhl-lkml@dif.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=pmarques@grupopie.com \
--cc=roland@topspin.com \
/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®