From: Andrew Morton <akpm@linux-foundation.org>
To: Jon Masters <jonathan@jonmasters.org>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@elte.hu,
rostedt@goodmis.org
Subject: Re: [RFC PATCH 1/1] smi_detector: A System Management Interrupt detector
Date: Tue, 9 Jun 2009 14:56:07 -0700 [thread overview]
Message-ID: <20090609145607.d8944778.akpm@linux-foundation.org> (raw)
In-Reply-To: <1244584201.30733.93.camel@localhost.localdomain>
On Tue, 09 Jun 2009 17:50:01 -0400
Jon Masters <jonathan@jonmasters.org> wrote:
> > > + if (0 != err)
> >
> > if (err != 0)
> >
> > or
> >
> > if (err)
> >
> > would be more typical.
>
> The former runs the risk of assignment,
yup, which is why gcc will warn if you do
if (err = 0)
If you really meant to do that, then gcc can be silenced by
double-parenthesising. We consider this "good enough" for kernel
purposes, so we generally don't use the `if (CONSTANT == variable)' trick.
> whereas <value> != <variable>
> will generate a compiler error if it goes wrong, so I trained myself to
> always do that. The desired value is zero, so I prefer to show that in
> the test, but I have changed it following your advice anyway - it's like
> how I have to force myself not to use '{' '}' on single line
> if-statements despite generally doing so, again for safety :)
next prev parent reply other threads:[~2009-06-09 21:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-31 16:31 [RFC PATCH 0/1] SMI Detector (v2) Jon Masters
2009-05-31 16:31 ` [RFC PATCH 1/1] smi_detector: A System Management Interrupt detector Jon Masters
2009-06-02 3:57 ` Andrew Morton
2009-06-02 7:54 ` Ingo Molnar
2009-06-02 13:41 ` Jon Masters
2009-06-09 21:50 ` Jon Masters
2009-06-09 21:56 ` Andrew Morton [this message]
2009-06-09 22:53 ` Jon Masters
2009-06-02 18:32 ` Paul E. McKenney
2009-06-02 20:32 ` Jon Masters
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=20090609145607.d8944778.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=jonathan@jonmasters.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.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