public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Amitoj Kaur Chawla <amitoj1606@gmail.com>,
	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, 03 Apr 2015 10:01:10 -0700	[thread overview]
Message-ID: <1428080470.13180.19.camel@perches.com> (raw)
In-Reply-To: <20150403165113.GU10964@mwanda>

On Fri, 2015-04-03 at 19:51 +0300, Dan Carpenter wrote:
> 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.

Very true.

> Also strcmp() and similar should always be done as == 0, < 0 or != 0
> because that is the idiom:

Less true.

When testing for equality, !strcmp is very common.

There are ~2500 uses of !strcmp in the kernel tree vs
~1500 uses of strcmp() == or !=



  reply	other threads:[~2015-04-03 17:01 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
2015-04-03 17:01   ` Joe Perches [this message]
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=1428080470.13180.19.camel@perches.com \
    --to=joe@perches.com \
    --cc=amitoj1606@gmail.com \
    --cc=dan.carpenter@oracle.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