On Tue, Sep 5, 2023 at 4:31 PM Rob Landley <r...@landley.net> wrote:
>
> On 9/5/23 15:44, Chet Ramey wrote:
> > On 9/5/23 4:32 PM, Dragan Simic wrote:
> >> On 2023-09-05 22:25, Chet Ramey wrote:
> >>> On 9/5/23 3:58 PM, enh wrote:
> >>>> On Fri, Sep 1, 2023 at 6:59 AM Chet Ramey <chet.ra...@case.edu> wrote:
> >>>
> >>>>> I think you'll find that, regardless of its origins, there are more
> >>>>> scripts
> >>>>> using the %b specifier than you think.
> >>>>
> >>>> i'd personally never heard of printf(1) %b before this thread, but
> >>>> debian code search agrees with you:
> >>>
> >>> It's a POSIX invention dating from at least 1991 (P1003.2-D11).
> >>>
> >>> The POSIX guidance to use it as a portable way to replace SysV echo has
> >>> dated from the same time. It's a pretty big lift to suddenly invalidate
> >>> all that prior art. ("POSIX giveth, and POSIX taketh away.").
> >>
> >> Are there any official explanations why is the invalidation actually
> >> happening now?
> >
> > https://lists.gnu.org/archive/html/bug-bash/2023-08/msg00112.html
> >
> > C23 is going to use %b to print binary literals.
>
> Upper case %B was taken?

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2612.pdf
"""
Ideally, the same would be done for an uppercase #B specifier for
binary numbers. However, §7.31.13 only reserves
lowercase letters for future library use; thus, an implementation
could have been using uppercase B for their own
extension already right now.

It is therefore proposed to suggest that an uppercase B format
specifier can either be used for printing binary
numbers, where the prefix in the alternate form becomes 0B, or it can
be handled in an implementation-defined
manner. That way, any existing implementation already using it would
not need to be changed. As a consequence,
portable code could not rely on #B printing a 0B prefix, but that
seems to be tolerable.
"""

> Rob
>

Reply via email to