[PATCH v4] fix warnings in sys/select.h fortification with -Wsign-conversion

Mike Frysinger vapier@gentoo.org
Wed Jun 13 03:15:00 GMT 2012


On Saturday 09 June 2012 16:24:14 Paul Eggert wrote:
> 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.

yes, these are all valid cases (as i mentioned), but still fairly minor 
overall

> >> 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.

as long as that's true, i'm fine going with Paul's latest version
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120613/f990c6c2/attachment.sig>


More information about the Libc-alpha mailing list