From: Joe Perches <joe@perches.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Michael Wang <wangyun@linux.vnet.ibm.com>,
jeffrey.t.kirsher@intel.com,
"e1000-devel@lists.sourceforge.net"
<e1000-devel@lists.sourceforge.net>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"wangyunlinux@gmail.com" <wangyunlinux@gmail.com>,
"Brandeburg, Jesse" <jesse.brandeburg@intel.com>
Subject: Re: [PATCH v2] e1000e: Assign true and false to bool type variable instead of 1 and 0
Date: Tue, 06 Dec 2011 23:39:23 -0800 [thread overview]
Message-ID: <1323243563.1762.42.camel@joe2Laptop> (raw)
In-Reply-To: <20111207072050.GC2203@ZenIV.linux.org.uk>
On Wed, 2011-12-07 at 07:20 +0000, Al Viro wrote:
> On Wed, Dec 07, 2011 at 02:36:20PM +0800, Michael Wang wrote:
> > On 12/07/2011 02:19 PM, Joe Perches wrote:
>
> [snip]
> > > if (*i2cctl & IXGBE_I2C_DATA_IN)
> > > - data = 1;
> > > + data = true;
> > > else
> > > - data = 0;
> > > + data = false;
> > >
> > > return data;
>
> Yuck...
>
> bool f(whatever)
> {
> bool data;
> if (expression)
> data = true;
> else
> data = false;
> return data;
> }
>
> is amazingly unidiomatic. Hell, if nothing else it's
> bool data = expression;
> return data;
> if not an outright
> return expression;
> or
> return (bool)expression;
> if you want to underline that it's treated as boolean... What tool
> has produced that patch?
tool has multiple meanings... :)
In this case though it's spatch (coccinelle)
I looked at it and thought the same thing as you.
The point though was not to do the idiomatic
transform that you correctly describe, but to
get Michael Wang to look at spatch as a tool
to do those transforms.
cheers, Joe
next prev parent reply other threads:[~2011-12-07 7:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 2:33 [PATCH v2] e1000e: Assign true and false to bool type variable instead of 1 and 0 Michael Wang
2011-12-07 3:43 ` Jeff Kirsher
2011-12-07 4:14 ` Joe Perches
2011-12-07 4:49 ` Michael Wang
2011-12-07 6:01 ` Joe Perches
2011-12-07 6:08 ` Michael Wang
2011-12-07 6:19 ` Joe Perches
2011-12-07 6:36 ` Michael Wang
2011-12-07 7:20 ` Al Viro
2011-12-07 7:39 ` Joe Perches [this message]
2011-12-07 9:04 ` Jeff Kirsher
2011-12-07 9:15 ` Michael Wang
2011-12-07 9:19 ` Jeff Kirsher
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=1323243563.1762.42.camel@joe2Laptop \
--to=joe@perches.com \
--cc=e1000-devel@lists.sourceforge.net \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=netdev@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
--cc=wangyun@linux.vnet.ibm.com \
--cc=wangyunlinux@gmail.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;
as well as URLs for NNTP newsgroup(s).