From: Linus Torvalds <torvalds@linux-foundation.org>
To: Joe Perches <joe@perches.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Brice Goglin <Brice.Goglin@inria.fr>,
Christoph Lameter <clameter@sgi.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Nick Piggin <npiggin@suse.de>, Hugh Dickins <hugh@veritas.com>
Subject: Re: mm: Don't touch uninitialized variable in do_pages_stat_array()
Date: Tue, 16 Dec 2008 12:35:25 -0800 (PST) [thread overview]
Message-ID: <alpine.LFD.2.00.0812161231500.14014@localhost.localdomain> (raw)
In-Reply-To: <1229456821.20606.19.camel@localhost>
On Tue, 16 Dec 2008, Joe Perches wrote:
>
> Perhaps this is more legible and avoids
> the unnecessary assignments to err.
Not only is it less legible to me, but the "unnecessary" assignments are
the ones that make the flow control much simpler.
I think it's a _lot_ easier to read
retval = BADNESS;
if (something bad)
goto out;
than it is to make the insides of the conditional more complex. It also
tends to generate better code, although gcc's code movement often makes it
not matter (and equally often makes a mess of it). That's because a
if (something)
goto somewhere;
is actually how the CPU itself ends up executing things, while a
if (something) {
retval = something;
goto somewhere;
}
actually ends up becoming
if (!someting)
goto over;
retval = something;
goto somewhere;
over:
by the time the CPU actually has to execute it.
Linus
prev parent reply other threads:[~2008-12-16 20:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200812161859.mBGIx1kR018513@hera.kernel.org>
2008-12-16 19:47 ` Joe Perches
2008-12-16 20:35 ` Linus Torvalds [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=alpine.LFD.2.00.0812161231500.14014@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=Brice.Goglin@inria.fr \
--cc=clameter@sgi.com \
--cc=hugh@veritas.com \
--cc=joe@perches.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=npiggin@suse.de \
/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®