Hehe, ok, I'll stop cleaning this stuff up then.
On Tue, 28 Nov 2006, Jesper Juhl wrote:
> In kernel/sys.c::sys_prctl() the argument named 'arg2' is very clearly
> of type 'unsigned long', and when compiling with "gcc -W" gcc also warns :
> kernel/sys.c:2089: warning: comparison of unsigned expression < 0 is always false
> So this patch removes the test of "arg2 < 0".
No, we don't do this.
This is why we don't compile with "-W". Gcc is crap.
The fact is, if it's unsigned, it's not something that the programmer
should have to care about. We should write our code to be readable and
obviously safe, and that means that
if (x < 0 || x > MAX)
is the _right_ way to do things, without having to carry stupid context
around in our heads.
If the compiler (whose _job_ it is to carry all that context and use it to
generate good code) notices that the fact that "x" is unsignes means that
one of the tests is unnecessary, that does not make it wrong.
Gcc warns for a lot of wrong things. This is one of them.
Friends don't let friends use "-W".