public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Vincent Lefevre <vincent@vinc17.net>
To: libc-alpha@sourceware.org
Subject: Re: Bad interaction between signal constants and -Wsign-conversion
Date: Thu, 30 Mar 2023 15:59:11 +0200	[thread overview]
Message-ID: <20230330135911.GA2458@cventin.lip.ens-lyon.fr> (raw)
In-Reply-To: <4e573abd-9ba0-e483-ab48-84e9ea98f90a@gmail.com>

On 2023-03-29 02:08:39 +0200, Alejandro Colomar via Libc-alpha wrote:
[about sa_flags in struct sigaction]
> Well, probably not doable now, but is switching to the unsigned counterpart
> still possible now?  It would require investigating how this member is
> being used out there, to know if we're going to break anyones code, and
> integer conversions are very tricky, so it's hard to know, but for a flags
> field that is to be used in bitwise operations, I don't expect anyone to
> actually use it as an int, but rather as an unsigned that for historic
> reasons happens to be signed.
> 
> This is also a reminder that new such fields in structures and function
> parameters should always be of unsigned types if they're going to hold
> flags (or in general, if they're to be treated as something that requires
> bitwise operations).

I entirely agree.

But concerning struct sigaction in particular, shouldn't this be fixed
in POSIX?

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

  parent reply	other threads:[~2023-03-30 13:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28  1:23 Zack Weinberg
2023-03-28  1:58 ` Paul Eggert
2023-03-28 14:03   ` Cyril Hrubis
2023-03-28 14:53     ` Florian Weimer
2023-03-28 15:04       ` Andreas Schwab
2023-03-28 18:50         ` Florian Weimer
2023-03-29  0:08 ` Alejandro Colomar
2023-03-30 13:45   ` Zack Weinberg
2023-03-30 13:59   ` Vincent Lefevre [this message]
2023-03-30 14:09     ` Alejandro Colomar
2023-03-31 15:31       ` Vincent Lefevre

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=20230330135911.GA2458@cventin.lip.ens-lyon.fr \
    --to=vincent@vinc17.net \
    --cc=libc-alpha@sourceware.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).