Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934470Ab3DKI3j (ORCPT ); Thu, 11 Apr 2013 04:29:39 -0400 Received: from perches-mx.perches.com ([206.117.179.246]:41739 "EHLO labridge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753464Ab3DKI3h (ORCPT ); Thu, 11 Apr 2013 04:29:37 -0400 Message-ID: <1365668975.1929.4.camel@joe-AO722> Subject: Re: [PATCH] checkpatch: Warn on comparisons to true and false From: Joe Perches To: Dan Carpenter Cc: Dave Jones , Andrew Morton , Andy Whitcroft , LKML , Jacob Pan Date: Thu, 11 Apr 2013 01:29:35 -0700 In-Reply-To: <20130411081943.GA6772@mwanda> References: <1365563834.27174.12.camel@joe-AO722> <20130410155751.7ecc6738d616fb8771991ce1@linux-foundation.org> <20130411021415.GA16118@redhat.com> <20130411081943.GA6772@mwanda> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.6.2-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 901 Lines: 21 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/