Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJgzZoqet3=k+J4oU_hsy9PLB_yDKsYMokD43zngZaS=TP5rwA@mail.gmail.com>
Date: Fri, 29 Jul 2022 16:21:33 -0700
From: enh <enh@...gle.com>
To: libc-coord@...ts.openwall.com
Subject: Re: anyone else working on %b?

On Fri, Jul 29, 2022 at 3:21 PM Joseph Myers <joseph@...esourcery.com> wrote:
>
> On Fri, 29 Jul 2022, enh wrote:
>
> > i've wanted %b (along with 0b literals) for decades now, and i'm
> > wondering if anyone else already has %b implemented, so i can use that
> > as precedent to justify shipping bionic's implementation before the
> > standard is final?
>
> I implemented printf %b and %B for glibc 2.35, and GCC 12 format checking.

awesome! i'll check clang more closely in that case then... maybe it's
already there but i didn't set -std=. otherwise i'll use gcc as
precedent to get that into clang :-)

> (The format checking also supports scanf %b.  I haven't yet implemented
> scanf %b in glibc; scanf is more complicated than printf here because it
> comes with changes to strtol, and scanf %i, which mean 32, 44 or 56 new
> function variants in glibc depending on the architecture, as described in
> <https://sourceware.org/pipermail/libc-alpha/2020-December/120414.html>,
> to keep proper compatibility with different standard versions.)

interesting. for no reason other than "i've never wanted it, so it was
last on my list", scanf() is the only part i haven't implemented yet.
i hadn't thought about that...

in terms of what's in the headers bionic takes the unusual stance of
"you get whatever's available at your OS version" and mostly ignores
the -std= version. (why? because people struggle enough reasoning
about the OS version [which is unavoidable] without having _multiple_
dimensions of "do i have this thing?". it's not an ideal stance for
experts, but experts are a lot better at getting themselves out of
mischief.)

but i'm not sure we've had a standard-specific _behavior_ before? the
closest i can remember is stuff like the GNU %m extensions (either the
printf %m errno one or the scanf %ms one). i'm assuming you never did
the experiment of enabling 0b/0B for everyone, so you don't know
whether anything broke?

> --
> 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.