Paul Mackerras writes:
> > And the solution is to treat it as a boolean instead?! I'm not sure
> > which is more ugly.
> >
> > Why wouldn't explicit comparison against NULL be the preferred fix?
>
> I just think this whole "you shouldn't compare a pointer to 0" thing
> is completely silly,
Inde
On Wed, Feb 08, 2006 at 03:58:59PM -0800, David S. Miller wrote:
> From: Herbert Xu <[EMAIL PROTECTED]>
> Date: Thu, 09 Feb 2006 10:49:37 +1100
>
> > The difference between gcc -pedantic and sparse is that it doesn't
> > warn about obviously correct cases like p != 0 or p = 0.
>
> So obviously co
On Wed, 8 Feb 2006, David S. Miller wrote:
> From: Herbert Xu <[EMAIL PROTECTED]>
> Date: Thu, 09 Feb 2006 10:49:37 +1100
>
> > The difference between gcc -pedantic and sparse is that it doesn't
> > warn about obviously correct cases like p != 0 or p = 0.
>
> So obviously correct that you left out
From: Herbert Xu <[EMAIL PROTECTED]>
Date: Thu, 09 Feb 2006 10:49:37 +1100
> The difference between gcc -pedantic and sparse is that it doesn't
> warn about obviously correct cases like p != 0 or p = 0.
So obviously correct that you left out an equals sign in the
second case :-)
-
To unsubscribe
Alexey Dobriyan <[EMAIL PROTECTED]> wrote:
>
> Oh, and for the record: current sparse from Linus doesn't warn about
> this. Slightly modified sparse warns. Bugs which were uncovered by
> more or less trivial and slightly broken sparse patch [1] are:
>
>[PATCH] dscc4: fix dscc4_init_dummy_
Alexey Dobriyan writes:
> The fact that they can be represented by the same bit patterns is
> irrelevant.
Indeed it is. The fact that the C standard says that "0" is a valid
representation for a null pointer in C source code *is* relevant,
though. That is in fact something that *wasn't* in K&R
On Wed, Feb 08, 2006 at 02:47:12PM -0800, David S. Miller wrote:
> From: David Stevens <[EMAIL PROTECTED]>
> 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).
>
> Becaus
On Wed, Feb 08, 2006 at 02:45:08PM -0800, David Stevens wrote:
> [EMAIL PROTECTED] wrote on 02/08/2006 02:19:20 PM:
>
> > James Carlson <[EMAIL PROTECTED]> wrote:
> > > Alexey Dobriyan writes:
> > >> - if (ap == 0)
> > >> + if (!ap)
> > >
> > > And the solution is to treat it as a boolean
David S. Miller wrote:
From: David Stevens <[EMAIL PROTECTED]>
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 c
David S. Miller writes:
> Because sparse goes beyond the standards and tries to
> catch cases that usually end up being bugs.
When has a pointer comparison with an explicit "0" ever caused a bug?
Paul.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message t
From: David Stevens <[EMAIL PROTECTED]>
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
James Carlson writes:
> Alexey Dobriyan writes:
> > - if (ap == 0)
> > + if (!ap)
>
> And the solution is to treat it as a boolean instead?! I'm not sure
> which is more ugly.
>
> Why wouldn't explicit comparison against NULL be the preferred fix?
I just think this whole "you shouldn't com
[EMAIL PROTECTED] wrote on 02/08/2006 02:19:20 PM:
> James Carlson <[EMAIL PROTECTED]> wrote:
> > Alexey Dobriyan writes:
> >> - if (ap == 0)
> >> + if (!ap)
> >
> > And the solution is to treat it as a boolean instead?! I'm not sure
> > which is more ugly.
>
> Treating it as a boolean
James> And the solution is to treat it as a boolean instead?! I'm
James> not sure which is more ugly.
James> Why wouldn't explicit comparison against NULL be the
James> preferred fix?
"if (ptr)" and "if (!ptr)" are the preferred idiom for testing whether
a pointer is NULL. What
James Carlson <[EMAIL PROTECTED]> wrote:
> Alexey Dobriyan writes:
>> - if (ap == 0)
>> + if (!ap)
>
> And the solution is to treat it as a boolean instead?! I'm not sure
> which is more ugly.
Treating it as a boolean looks good to me. It's better than the existing
code because it shuts
Alexey Dobriyan writes:
> - if (ap == 0)
> + if (!ap)
And the solution is to treat it as a boolean instead?! I'm not sure
which is more ugly.
Why wouldn't explicit comparison against NULL be the preferred fix?
--
James Carlson 42.703N 71.076W <[EMAIL PROTECTED]>
-
To un
Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]>
---
ppp is the biggest offender.
drivers/net/ppp_async.c | 34 ++--
drivers/net/ppp_generic.c | 128 +++---
drivers/net/ppp_synctty.c | 26 -
drivers/net/pppoe.c |2
4 fil
17 matches
Mail list logo