linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Dave Jones <davej@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andy Whitcroft <apw@shadowen.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jacob Pan <jacob.jun.pan@linux.intel.com>
Subject: Re: [PATCH] checkpatch: Warn on comparisons to true and false
Date: Thu, 11 Apr 2013 01:29:35 -0700	[thread overview]
Message-ID: <1365668975.1929.4.camel@joe-AO722> (raw)
In-Reply-To: <20130411081943.GA6772@mwanda>

On Thu, 2013-04-11 at 11:19 +0300, Dan Carpenter wrote:
> On Wed, Apr 10, 2013 at 10:14:15PM -0400, Dave Jones wrote:
> > It would be interesting to see how many people have historically screwed 
> > up and used (!a) when they mean (a) and vice versa, versus spelling
> > it out longform.  I'd be surprised if the results weren't skewed
> > in favour of the more verbose form.
> 
> I see a the occasional reversed test in Smatch but normally these
> kind of bugs are detected with basic testing so they are rare.

I'd guess the most common error would be using
an int comparison when the value is not 0 or 1.

Non-zero is still "true" but isn't == true.



  reply	other threads:[~2013-04-11  8:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10  3:17 Joe Perches
2013-04-10  9:33 ` Andy Whitcroft
2013-04-10 11:27   ` Joe Perches
2013-04-10 12:41     ` Andy Whitcroft
2013-04-10 22:57 ` Andrew Morton
2013-04-11  1:07   ` Joe Perches
2013-04-11  2:14   ` Dave Jones
2013-04-11  3:47     ` Joe Perches
2013-04-11  8:19     ` Dan Carpenter
2013-04-11  8:29       ` Joe Perches [this message]
2013-04-11 11:56     ` Bjørn Mork
2013-04-11 14:25       ` Joe Perches

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=1365668975.1929.4.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=dan.carpenter@oracle.com \
    --cc=davej@redhat.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] checkpatch: Warn on comparisons to true and false' \
    /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

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).