From: Andrew Morton <akpm@linux-foundation.org>
To: lsorense@csclub.uwaterloo.ca (Lennart Sorensen)
Cc: Anas Nashif <nashif@linux.intel.com>,
linux-kernel@vger.kernel.org, Marek Dabek <marek.dabek@intel.com>
Subject: Re: [PATCH] Intel Manageability Engine Interface driver
Date: Tue, 23 Oct 2007 09:32:16 -0700 [thread overview]
Message-ID: <20071023093216.06d8f415.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071023150429.GK4003@csclub.uwaterloo.ca>
On Tue, 23 Oct 2007 11:04:29 -0400 lsorense@csclub.uwaterloo.ca (Lennart Sorensen) wrote:
> On Mon, Oct 22, 2007 at 11:40:01AM -0700, Andrew Morton wrote:
> > - Here:
> >
> > + if (0 == memcmp(&heci_wd_guid,
> >
> > we boringly prefer "if (foo == 0)" rather than "if (0 == foo)". (lots
> > of places).
>
> But 0 == blah is safer. If you accidentally do 0 = blah the compiler
> will tell you.
If you do 'if (blah = 0)' then compiler will tell you too. To all intents
and purposes this invalidates the reasons for doing `if (0 == blah)'.
> Just because people have always done it the other way
> around doesn't make it the right way to do it. I have noticed many
> people have started to realize this in the last few years.
>
> It is also much clearer that you are comparing against a constant and
> not doing an assignment when the constant comes before the variable.
>
> I think to encourage people doing it the less safe way is just silly.
It isn't less safe.
> Some places in the kernel that already uses the constant first are:
It impacts readability. All the aio code was implemented that way for a
few years and it drove everyone so batty that we undid it.
next prev parent reply other threads:[~2007-10-23 16:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-22 17:22 [PATCH] Intel Manageability Engine Interface driver Anas Nashif
2007-10-22 18:28 ` Xavier Bestel
2007-10-22 18:40 ` Andrew Morton
2007-10-23 13:31 ` Anas Nashif
2007-10-23 13:36 ` Maxim Levitsky
2007-10-23 16:25 ` Andrew Morton
2007-10-23 15:04 ` Lennart Sorensen
2007-10-23 16:23 ` Arjan van de Ven
2007-10-23 18:05 ` Lennart Sorensen
2007-10-23 18:22 ` Roland Dreier
2007-10-23 19:35 ` Lennart Sorensen
2007-10-24 9:00 ` Bernd Petrovitsch
2007-10-23 16:32 ` Andrew Morton [this message]
2007-10-22 22:30 ` Maxim Levitsky
2007-10-23 13:35 ` Anas Nashif
2007-10-23 13:42 ` Maxim Levitsky
2007-10-25 9:33 ` Gerd Hoffmann
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=20071023093216.06d8f415.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lsorense@csclub.uwaterloo.ca \
--cc=marek.dabek@intel.com \
--cc=nashif@linux.intel.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