lkml.org 
[lkml]   [2005]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] fs/fcntl.c : don't test unsigned value for less than zero
Date
Christoph Hellwig <hch@infradead.org> wrote:
>
>> No, it was exactly this patch:
>> http://www.ussg.iu.edu/hypermail/linux/kernel/0401.0/1816.html
>
> Hmm. Looks I absolutely disagree with Linus on this one ;-)

Me too. The compiler doesn't really have much choice here. If
it ignores all comparisons of unsigned integers to less than zero
then we could miss real bugs like this:

int foo(unsigned int val)
{
return val < 0;
}

where the user probably wanted a signed comparison.

I suppose it could be smart and stay quiet about

val < 0 || val > BOUND

However, gcc is slow enough as it is without adding unnecessary
smarts like this.
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
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/

\
 
 \ /
  Last update: 2005-04-15 14:09    [W:1.653 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site