Re: patch: signed char issues

From: James Sutherland (jas88@cam.ac.uk)
Date: Mon Apr 24 2000 - 06:59:44 EST


On Mon, 24 Apr 2000, Philip Blundell wrote:

> >Unfortunately, people forget about signed-ness issues. I actually wish
> >that GCC would warn more about this type of unportable code. (eg,
> >detecting an assignment or test between a bare "char" type and a
> >negative number).
>
> GCC already warns about comparison between an unsigned type and a negative
> constant. It also has the capability to warn about any comparison between a
> signed type and an unsigned one, though I don't think this is used by default
> when building the kernel because it generates a lot of noise.
>
> There doesn't seem to be any warning for assignment of a negative value to an
> unsigned variable, though I don't imagine it would be hard to add.

Part of the problem is that "char" may be signed on one platform, but
unsigned on another. Wouldn't using "-fsigned-char" to GCC help? This, at
least, would ensure the build environment is always consistent...

James.

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



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:07 EST