Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250606002609.GI1827@brightrain.aerifal.cx>
Date: Thu, 5 Jun 2025 20:26:09 -0400
From: Rich Felker <dalias@...c.org>
To: Andy Caldwell <andy.m.caldwell@...glemail.com>
Cc: musl@...ts.openwall.com, David Steele <david@...ackrest.org>,
	noloader@...il.com
Subject: Re: Sign conversion warning in FD_ISSET()

On Fri, Jun 06, 2025 at 01:23:14AM +0100, Andy Caldwell wrote:
> > > There probably is some way to get it right with clever use of the
> > > ternary operator but I haven't come up with anything in the first few
> > > seconds thinking about it.
> > >
> > > Rich
> 
> Yes, the ternary operator can be used to create a C89-compatible
> version (this allows anything coercible to an `int` or an `unsigned`,
> so it mostly only refuses pointers and structures).
> 
> #define SOCKET_TO_UNSIGNED(s) ((unsigned)(1?(s):0))

Nope, that accepts a pointer. Make it 42 instead of 0. Or just 1.

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.