From: Mikael Pettersson <mikpe@csd.uu.se>
To: Paul Jackson <pj@sgi.com>
Cc: akiyama.nobuyuk@jp.fujitsu.com, akpm@osdl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NMI trigger switch support for debugging
Date: Wed, 26 May 2004 23:04:00 +0200 [thread overview]
Message-ID: <16565.1600.168844.334347@alkaid.it.uu.se> (raw)
In-Reply-To: <20040526133438.196ca930.pj@sgi.com>
Paul Jackson writes:
> Mikael Pettersson, replying to AKIYAMA Nobuyuki:
> > > + if (!old_state == !unknown_nmi_panic)
> > > + return 0;
> >
> > This conditional looks terribly obscure.
>
> Would the following variant seem clearer:
>
> if (!!unknown_nmi_panic == !!old_state)
> return 0;
>
> Odd, I know. For those of us familiar with the '!!' idiom, which
> converts any value to its binary logical equivalent 0 (if zero) or
> 1 (otherwise), this reads as:
>
> if (the logical value of unknown_nmi_panic is unchanged)
> return 0;
The !! idiom has the advantage of making it crystal clear
that the author is comparing boolean-normalised values.
The code I commented on was unusual enough that I couldn't
ignore the possibility of a bug.
In this case, I'd prefer the !! idiom, or moving the test into
the two state-changing code snippets below it.
/Mikael
next prev parent reply other threads:[~2004-05-26 21:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-24 9:21 AKIYAMA Nobuyuki
2004-05-24 9:34 ` Andrew Morton
2004-05-26 1:36 ` AKIYAMA Nobuyuki
2004-05-26 1:41 ` Andrew Morton
2004-05-26 2:28 ` AKIYAMA Nobuyuki
2004-05-26 2:37 ` Andrew Morton
2004-05-26 12:17 ` AKIYAMA Nobuyuki
2004-05-26 12:52 ` Maciej W. Rozycki
2004-05-27 8:43 ` AKIYAMA Nobuyuki
2004-05-26 9:43 ` Mikael Pettersson
2004-05-26 13:42 ` AKIYAMA Nobuyuki
2004-05-26 20:34 ` Paul Jackson
2004-05-26 21:04 ` Mikael Pettersson [this message]
2004-05-24 10:01 ` [PATCH] typo in drivers/usb/class/usblp.c Benoît Dejean
[not found] <1ZjWz-sq-11@gated-at.bofh.it>
[not found] ` <1Zk6a-z2-3@gated-at.bofh.it>
[not found] ` <1ZVyO-63D-25@gated-at.bofh.it>
[not found] ` <1ZVIq-69O-3@gated-at.bofh.it>
[not found] ` <1ZWuM-6Nz-1@gated-at.bofh.it>
[not found] ` <1ZWEt-6Uw-1@gated-at.bofh.it>
2004-05-26 11:23 ` [PATCH] NMI trigger switch support for debugging Andi Kleen
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=16565.1600.168844.334347@alkaid.it.uu.se \
--to=mikpe@csd.uu.se \
--cc=akiyama.nobuyuk@jp.fujitsu.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pj@sgi.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®