Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2208031242540.924046@digraph.polyomino.org.uk>
Date: Wed, 3 Aug 2022 12:47:56 +0000
From: Joseph Myers <joseph@...esourcery.com>
To: <libc-coord@...ts.openwall.com>
CC: enh <enh@...gle.com>
Subject: Re: anyone else working on %b?

On Tue, 2 Aug 2022, Keith Packard wrote:

> Should scanf's %i format parse the leading 0b/0B to indicate
> binary?

Yes.  (Formally that's a consequence of the introduction of binary 
literals in C23 - a change to the language specification with consequences 
for library requirements - since strtol base 0 accepts literal prefixes 
and %i is defined in terms of strtol base 0.)

> Should %b/%B permit a leading 0b/0B?

Yes.  (There's no scanf %B defined or mentioned in recommended practice in 
C23 since it wouldn't be any different from %b.)  scanf %b is defined in 
terms of strtol base 2 and the same changes that added %b support to C23 
also added a specification that strtol base 2 accepts those prefixes.

-- 
Joseph S. Myers
joseph@...esourcery.com

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.