From: Dan Carpenter <dan.carpenter@oracle.com>
To: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value
Date: Fri, 3 Apr 2015 19:51:13 +0300 [thread overview]
Message-ID: <20150403165113.GU10964@mwanda> (raw)
In-Reply-To: <20150403164211.GA6422@amitoj-Inspiron-3542>
On Fri, Apr 03, 2015 at 10:12:11PM +0530, Amitoj Kaur Chawla wrote:
> Removes variable comparison with 0 by using !.
Sometimes testing for zero makes sense. When you write code, you are
telling a story. If you are talking about zero as a number then it
can make sense. If it's zero as a boolean then it doesn't make sense.
Also strcmp() and similar should always be done as == 0, < 0 or != 0
because that is the idiom:
if name != "foo" then
becomes:
if (strcmpt(name, "foo") != 0) {
The != from the first is shifted in the second.
So I don't really think this approach is the right thing. You have to
read the code and understand the story it is telling. Then change it
if needed.
regards,
dan carpenter
next prev parent reply other threads:[~2015-04-03 16:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-03 16:42 [PATCH] Staging: rtl8188eu: Remove zero testing pointer typed value Amitoj Kaur Chawla
2015-04-03 16:51 ` Dan Carpenter [this message]
2015-04-03 17:01 ` Joe Perches
2015-04-03 21:04 ` Dan Carpenter
2015-04-04 13:58 ` Dan Carpenter
2015-04-04 15:52 ` Joe Perches
2015-04-03 17:03 ` Amitoj Kaur Chawla
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=20150403165113.GU10964@mwanda \
--to=dan.carpenter@oracle.com \
--cc=amitoj1606@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
/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