All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Richard Knutsson <ricknu-0@student.ltu.se>
Cc: Mike Frysinger <vapier.adi@gmail.com>,
	Robin Getz <rgetz@blackfin.uclinux.org>,
	Yoann Padioleau <padator@wanadoo.fr>,
	David Howells <dhowells@redhat.com>,
	kernel-janitors@vger.kernel.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 06/68] 0 -> NULL, for arch/frv
Date: Wed, 01 Aug 2007 20:28:15 +0000	[thread overview]
Message-ID: <20070801202815.GL11166@waste.org> (raw)
In-Reply-To: <46B062AF.1040907@student.ltu.se>

On Wed, Aug 01, 2007 at 12:38:39PM +0200, Richard Knutsson wrote:
> Mike Frysinger wrote:
> >On 7/31/07, Richard Knutsson <ricknu-0@student.ltu.se> wrote:
> >  
> >>Mike Frysinger wrote:
> >>    
> >>>On 7/27/07, Robin Getz <rgetz@blackfin.uclinux.org> wrote:
> >>>      
> >>>>If there is a definite style or semantic preference that everyone 
> >>>>should live
> >>>>with - does it make sense to put checks in checkpatch.pl to enforce it?
> >>>>        
> >>>checkpatch.pl does not have enough semantic knowledge to know if the
> >>>thing being tested is a pointer ... dont know if the sparse utility
> >>>would be able to pick it out as i'm not familiar with what level that
> >>>thing runs at
> >>>      
> >>Didn't he mean "x = NULL" > "!x"?
> >>    
> >
> >i'm sure i understand your meaning of ">" ... are you saying that "x
> >= NULL" is greater (preferred) to "!x" or are you saying that "x =
> >NULL" should be changed to "!x" ?
> >  
> If I understood Robin correctly, he suggested that checkpatch.pl would 
> tell to convert "x = NULL" to "!x", if that would be the preferred way.
> >i dont think the former case can be checked by checkpatch.pl, but the
> >latter certainly can ... but i'd be very skeptical you could get the
> >wider LKML audience to sign off one way or the other wrt to "x =
> >NULL" vs "!x".  you can certainly get people to sign off on "x = 0"
> >being wrong when x is a pointer.
> >  
> I agree!
> BTW, too bad checkpatch.pl does not know the types, since it otherwise 
> could check for the "x [=!]= 0"-thing.

About the only place that if (x != 0) is preferred to if (x) is cases
where the 0 value doesn't semantically correspond to false/off/disabled.
And that's basically thing that return 0 for success and negative errors.

-- 
Mathematics is the supreme nostalgia of our time.

WARNING: multiple messages have this Message-ID (diff)
From: Matt Mackall <mpm@selenic.com>
To: Richard Knutsson <ricknu-0@student.ltu.se>
Cc: Mike Frysinger <vapier.adi@gmail.com>,
	Robin Getz <rgetz@blackfin.uclinux.org>,
	Yoann Padioleau <padator@wanadoo.fr>,
	David Howells <dhowells@redhat.com>,
	kernel-janitors@vger.kernel.org, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 06/68] 0 -> NULL, for arch/frv
Date: Wed, 1 Aug 2007 15:28:15 -0500	[thread overview]
Message-ID: <20070801202815.GL11166@waste.org> (raw)
In-Reply-To: <46B062AF.1040907@student.ltu.se>

On Wed, Aug 01, 2007 at 12:38:39PM +0200, Richard Knutsson wrote:
> Mike Frysinger wrote:
> >On 7/31/07, Richard Knutsson <ricknu-0@student.ltu.se> wrote:
> >  
> >>Mike Frysinger wrote:
> >>    
> >>>On 7/27/07, Robin Getz <rgetz@blackfin.uclinux.org> wrote:
> >>>      
> >>>>If there is a definite style or semantic preference that everyone 
> >>>>should live
> >>>>with - does it make sense to put checks in checkpatch.pl to enforce it?
> >>>>        
> >>>checkpatch.pl does not have enough semantic knowledge to know if the
> >>>thing being tested is a pointer ... dont know if the sparse utility
> >>>would be able to pick it out as i'm not familiar with what level that
> >>>thing runs at
> >>>      
> >>Didn't he mean "x == NULL" > "!x"?
> >>    
> >
> >i'm sure i understand your meaning of ">" ... are you saying that "x
> >== NULL" is greater (preferred) to "!x" or are you saying that "x ==
> >NULL" should be changed to "!x" ?
> >  
> If I understood Robin correctly, he suggested that checkpatch.pl would 
> tell to convert "x == NULL" to "!x", if that would be the preferred way.
> >i dont think the former case can be checked by checkpatch.pl, but the
> >latter certainly can ... but i'd be very skeptical you could get the
> >wider LKML audience to sign off one way or the other wrt to "x ==
> >NULL" vs "!x".  you can certainly get people to sign off on "x == 0"
> >being wrong when x is a pointer.
> >  
> I agree!
> BTW, too bad checkpatch.pl does not know the types, since it otherwise 
> could check for the "x [=!]= 0"-thing.

About the only place that if (x != 0) is preferred to if (x) is cases
where the 0 value doesn't semantically correspond to false/off/disabled.
And that's basically thing that return 0 for success and negative errors.

-- 
Mathematics is the supreme nostalgia of our time.

  reply	other threads:[~2007-08-01 20:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-27  9:44 [PATCH 06/68] 0 -> NULL, for arch/frv Yoann Padioleau
2007-07-27  9:44 ` Yoann Padioleau
2007-07-27 10:00 ` Al Viro
2007-07-27 10:00   ` Al Viro
2007-07-27 10:21   ` Yoann Padioleau
2007-07-27 10:21     ` Yoann Padioleau
2007-07-27 10:40     ` Al Viro
2007-07-27 10:40       ` Al Viro
2007-07-27 10:14 ` David Howells
2007-07-27 10:14   ` David Howells
2007-07-27 10:18   ` Yoann Padioleau
2007-07-27 10:18     ` Yoann Padioleau
2007-07-28  1:38     ` Robin Getz
2007-07-28  1:38       ` Robin Getz
2007-07-28  1:37       ` Mike Frysinger
2007-07-28  1:37         ` Mike Frysinger
2007-07-31 12:04         ` Richard Knutsson
2007-07-31 12:04           ` Richard Knutsson
2007-08-01 10:03           ` Mike Frysinger
2007-08-01 10:03             ` Mike Frysinger
2007-08-01 10:38             ` Richard Knutsson
2007-08-01 10:38               ` Richard Knutsson
2007-08-01 20:28               ` Matt Mackall [this message]
2007-08-01 20:28                 ` Matt Mackall
2007-08-02 14:58               ` Robin Getz
2007-08-02 14:58                 ` Robin Getz

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=20070801202815.GL11166@waste.org \
    --to=mpm@selenic.com \
    --cc=akpm@linux-foundation.org \
    --cc=dhowells@redhat.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=padator@wanadoo.fr \
    --cc=rgetz@blackfin.uclinux.org \
    --cc=ricknu-0@student.ltu.se \
    --cc=vapier.adi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.