public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Vincent Lefevre <vincent@vinc17.net>
To: libc-alpha@sourceware.org
Subject: printf: 0 flag and given precision for %b
Date: Fri, 31 Mar 2023 17:40:16 +0200	[thread overview]
Message-ID: <20230331154016.GC2458@cventin.lip.ens-lyon.fr> (raw)

In the WG14 / N3088 C2x draft, the 0 flag is not ignored for %b when
a precision is specified:

  0   For b, d, i, o, u, x, X, a, A, e, E, f, F, g, and G conversions,
      leading zeros (following any indication of sign or base) are used
      to pad to the field width rather than performing space padding,
      except when converting an infinity or NaN. If the 0 and - flags
      both appear, the 0 flag is ignored. For d, i, o, u, x, and X
      conversions, if a precision is specified, the 0 flag is ignored.
      For other conversions, the behavior is undefined.

But glibc appears to ignore the 0 flag in this case. Is this a bug,
or has the %b case been forgotten in this current draft?

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

                 reply	other threads:[~2023-03-31 15:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230331154016.GC2458@cventin.lip.ens-lyon.fr \
    --to=vincent@vinc17.net \
    --cc=libc-alpha@sourceware.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).