This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v4] fix warnings in sys/select.h fortification with -Wsign-conversion
On 06/09/2012 11:55 AM, Mike Frysinger wrote:
> in all cases where this is used, trying to use a pointer will trigger a build
> failure.
True, but that's brittle, as it depends on some other internal macro
having certain properties, and these properties aren't documented.
And even if it works with pointers, it will fail in other cases.
For example, the cast will cause diagnostics to be suppressed for
FD_ISSET (4294967296, s) on a 32-bit machine, even though there
should be a diagnostic.
>> Paul came up with a better patch, which doesn't have this
>> problem, and I propose that it be installed instead.
>
> it has slightly more overhead
Not for any modern compiler with normal optimization;
they all turn (0 <= x && x < CONSTANT) into a single
unsigned comparison, even if x is signed.