|
|
Message-ID: <Pine.BSM.4.64L.2407181649320.2401@herc.mirbsd.org>
Date: Thu, 18 Jul 2024 16:54:23 +0000 (UTC)
From: Thorsten Glaser <tg@...bsd.de>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 1/1] FD_SET() and FD_ISSET() warn on -Wsign-conversion
Rich Felker dixit:
>What's really frustrating about these kinds of garbage warnings is
>that they encourage (as in the proposed patch) writing casts that
>*remove type-safety* and make very-wrong code silently compile "fine",
>for the purpose of suppressing a warning that's supposedly about a
>type-safety issue.
The warning *can* be useful, though.
You could always hide a cast-y version behind __extension__({…})
if GCC or compatible is detected (ugh).
For *this* specific case, it might be sufficient to instead cast
the constant term to signed (I can’t believe I found a case where
using signed ints, despite the UB danger, is the possible fix):
#define FD_SET(d,s) ((s)->fds_bits[(d) / (int)(8 * sizeof(long))] |= \
(1UL << ((d) % (int)(8 * sizeof(long)))))
bye,
//mirabilos
--
11:56⎜«liwakura:#!/bin/mksh» also, i wanted to add mksh to my own distro │
i was disappointed that there is no makefile │ but somehow the Build.sh is
the least painful built system i've ever seen │ honours CC, {CPP,C,LD}FLAGS
properly │ looks cleary like done by someone who knows what they are doing
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.