mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: Markus Wichmann <nullplan@gmx.net>
Cc: musl@lists.openwall.com
Subject: Re: [musl] Musl's FD_{SET,ISSET,CLR} macros from sys/select.h trigger gcc's -Wsign-conversion warnings
Date: Mon, 3 Aug 2020 13:47:07 -0400	[thread overview]
Message-ID: <20200803174707.GF6949@brightrain.aerifal.cx> (raw)
In-Reply-To: <20200803054343.GF2076@voyager>

On Mon, Aug 03, 2020 at 07:43:43AM +0200, Markus Wichmann wrote:
> On Sun, Aug 02, 2020 at 09:43:56PM +0200, Petr Skocik wrote:
> > A direct size_t cast of (d) could potentially do some type-unsafe things (like convert a pointer),
> 
> Then just add 0ul? Pointers stay pointers, and ints become unsigned
> longs. Only signed long longs remain signed, but using 0ull would turn
> this into 64-bit calculations on 32-bit systems, typically requiring
> libgcc calls. Also, storing FDs in long longs is a tad overkill, and
> probably not the normal case.

That's no different than what the code is already doing, getting the
desired promotion via C's promotion rules. Unfortunately compilers are
wrongly complaining about it because it doesn't meet their preferred
style rules.

Rich

      reply	other threads:[~2020-08-03 17:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 18:24 Petr Skocik
2020-08-02 18:53 ` Alexander Monakov
2020-08-02 18:56   ` Alexander Monakov
2020-08-02 19:43   ` Petr Skocik
2020-08-03  5:43     ` Markus Wichmann
2020-08-03 17:47       ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200803174707.GF6949@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    --cc=nullplan@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).