public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: Paul Eggert <eggert@cs.ucla.edu>,
	 Zack Weinberg <zack@owlfolio.org>,
	GNU libc development <libc-alpha@sourceware.org>
Subject: Re: Bad interaction between signal constants and -Wsign-conversion
Date: Tue, 28 Mar 2023 16:53:14 +0200	[thread overview]
Message-ID: <87h6u5udut.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <ZCLzwrFjda/cyXXj@yuki> (Cyril Hrubis's message of "Tue, 28 Mar 2023 16:03:46 +0200")

* Cyril Hrubis:

> Hi!
>> > # define SA_RESETHAND ((int)0x80000000) /* Reset to SIG_DFL on entry to handler.  */
>> > 
>> > Anyone got a better idea?
>> 
>> Perhaps this instead:
>> 
>>    #define SA_RESETHAND (-1 - 0x7fffffff)
>
> Why not (1<<31) ?

Some compilers warn about it, too.  Shifting into the sign position is
undefined in the standard.

I suggest to write out the negative constants explicitly, as a decimal
integer.

  reply	other threads:[~2023-03-28 14:53 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 [this message]
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
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=87h6u5udut.fsf@mid.deneb.enyo.de \
    --to=fw@deneb.enyo.de \
    --cc=chrubis@suse.cz \
    --cc=eggert@cs.ucla.edu \
    --cc=libc-alpha@sourceware.org \
    --cc=zack@owlfolio.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).