Re: [PATCH] mm/slab.c remove impossible <0 check - size_t is not signed - patch is against 2.6.1-rc1-mm2

From: Jens Axboe
Date: Thu Jan 08 2004 - 10:30:11 EST


On Thu, Jan 08 2004, Paul Jackson wrote:
> Jason asked:
> > Well, anything wrong in cleaning them [unsigned compare warnings] up?
>
> It's more important that we write code that will fit in our limited
> human brains than that we write code that will avoid spurious warnings
> from gcc ('spurious' meaning warnings for code that gcc will correctly
> compile anyway).
>
> Or, see a couple months ago, in a thread with the Subject of:
>
> [PATCH] irda: fix type of struct irda_ias_set.attribute.irda_attrib_string.len
>
> in which Linus wrote:
> > That's why I hate the "sign compare" warning of gcc so much - it warns
> > about things that you CANNOT sanely write in any other way. That makes
> > that particular warning _evil_, since it encourages people to write crap
> > code.

That's fine and has its place, no doubt about that. It doesn't cover the
patch in this thread though. The check is dead code. It's a cosmetic
problem though, gcc should not generate the code checking for < 0.

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/