From: Rick Jones <rick.jones2@hp.com>
Cc: linux-ppp@vger.kernel.org, netdev@vger.kernel.org,
netdev-owner@vger.kernel.org, viro@ftp.linux.org.uk
Subject: Re: [PATCH] ppp: don't use 0 in pointer context
Date: Wed, 08 Feb 2006 23:00:24 +0000 [thread overview]
Message-ID: <43EA7808.6060105@hp.com> (raw)
In-Reply-To: <20060208.144712.66821895.davem@davemloft.net>
David S. Miller wrote:
> From: David Stevens <dlstevens@us.ibm.com>
> Date: Wed, 8 Feb 2006 14:45:08 -0800
>
>
>> Why would sparse complain about this? 0 is a well-defined
>>pointer value (the only value guaranteed to be by the language).
>
>
> Because sparse goes beyond the standards and tries to
> catch cases that usually end up being bugs.
So, how might it tell when someone is mistakenly using a pointer as a boolean if
it takes a pass on if(foo) or if(!foo) instead of looking for if(foo = NULL)
or if(foo != NULL)? (or I suppose if (NULL = foo) and if (NULL != foo))
it would seem that the compars with NULL, when read by pseudorandom folks would
be more likely to reinforce that foo is a pointer rather than a boolean/flag.
rick jones
WARNING: multiple messages have this Message-ID (diff)
From: Rick Jones <rick.jones2@hp.com>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-ppp@vger.kernel.org, netdev@vger.kernel.org,
netdev-owner@vger.kernel.org, viro@ftp.linux.org.uk
Subject: Re: [PATCH] ppp: don't use 0 in pointer context
Date: Wed, 08 Feb 2006 15:00:24 -0800 [thread overview]
Message-ID: <43EA7808.6060105@hp.com> (raw)
In-Reply-To: <20060208.144712.66821895.davem@davemloft.net>
David S. Miller wrote:
> From: David Stevens <dlstevens@us.ibm.com>
> Date: Wed, 8 Feb 2006 14:45:08 -0800
>
>
>> Why would sparse complain about this? 0 is a well-defined
>>pointer value (the only value guaranteed to be by the language).
>
>
> Because sparse goes beyond the standards and tries to
> catch cases that usually end up being bugs.
So, how might it tell when someone is mistakenly using a pointer as a boolean if
it takes a pass on if(foo) or if(!foo) instead of looking for if(foo == NULL)
or if(foo != NULL)? (or I suppose if (NULL == foo) and if (NULL != foo))
it would seem that the compars with NULL, when read by pseudorandom folks would
be more likely to reinforce that foo is a pointer rather than a boolean/flag.
rick jones
next prev parent reply other threads:[~2006-02-08 23:00 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-08 22:28 [PATCH] ppp: don't use 0 in pointer context Alexey Dobriyan
2006-02-08 22:28 ` Alexey Dobriyan
2006-02-08 22:14 ` James Carlson
2006-02-08 22:14 ` James Carlson
2006-02-08 22:19 ` Herbert Xu
2006-02-08 22:19 ` Herbert Xu
2006-02-08 22:45 ` David Stevens
2006-02-08 22:45 ` David Stevens
2006-02-08 22:47 ` David S. Miller
2006-02-08 22:47 ` David S. Miller
2006-02-08 22:51 ` Paul Mackerras
2006-02-08 22:51 ` Paul Mackerras
2006-02-08 23:00 ` Rick Jones [this message]
2006-02-08 23:00 ` Rick Jones
2006-02-08 23:08 ` Herbert Xu
2006-02-08 23:08 ` Herbert Xu
2006-02-08 23:22 ` Alexey Dobriyan
2006-02-08 23:22 ` Alexey Dobriyan
2006-02-08 23:26 ` Paul Mackerras
2006-02-08 23:26 ` Paul Mackerras
2006-02-08 23:49 ` Herbert Xu
2006-02-08 23:49 ` Herbert Xu
2006-02-08 23:58 ` David S. Miller
2006-02-08 23:58 ` David S. Miller
2006-02-09 0:05 ` Randy.Dunlap
2006-02-09 0:05 ` Randy.Dunlap
2006-02-09 0:06 ` Herbert Xu
2006-02-09 0:06 ` Herbert Xu
2006-02-08 22:23 ` Roland Dreier
2006-02-08 22:23 ` Roland Dreier
2006-02-08 22:30 ` Bill Unruh
2006-02-08 22:44 ` Paul Mackerras
2006-02-08 22:44 ` Paul Mackerras
2006-02-09 13:15 ` James Carlson
2006-02-09 13:15 ` James Carlson
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=43EA7808.6060105@hp.com \
--to=rick.jones2@hp.com \
--cc=linux-ppp@vger.kernel.org \
--cc=netdev-owner@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/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.