From: "Nadav Har'El" <nyh@scylladb.com>
To: musl@lists.openwall.com
Cc: "Nadav Har'El" <nyh@scylladb.com>
Subject: Handling of L and ll prefixes different from glibc
Date: Wed, 14 Dec 2016 15:46:40 +0200 [thread overview]
Message-ID: <CANEVyjtv7+kqyDjyYiSv7yq7YLvvJo9Ti0PSGcjQ3dVMgjqF1w@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1100 bytes --]
Hi,
Posix's printf manual suggests (see
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fprintf.html)
that the "ll" format prefix should only be used for integer types, and "L"
should only be used for long double type. And it seems that indeed, this is
what Musl's printf() supports - the test program
long double d = 123.456;
printf("Lf: %Lf\n", d);
printf("llf %llf\n", d);
long long int i = 123456;
printf("Ld: %Ld\n", i);
printf("lld: %lld\n", i);
produces with Musl's printf just two lines of output:
Lf: 123.456000
lld: 123456
The two other printf()s (with %Ld and %llf) are silently dropped.
However, in glibc, it seems that "ll" and "L" are synonyms, and both work
for both integer and floating types. The above program produces with glibc
four lines of output:
Lf: 123.456000
llf 123.456000
Ld: 123456
lld: 123456
If Musl's intention is to be compatible with glibc, not Posix, I guess this
behavior should be fixed, and LL and ll should become synonyms, not
different flags?
Thanks,
Nadav.
--
Nadav Har'El
nyh@scylladb.com
[-- Attachment #2: Type: text/html, Size: 1789 bytes --]
next reply other threads:[~2016-12-14 13:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 13:46 Nadav Har'El [this message]
2016-12-14 16:13 ` Rich Felker
2016-12-14 17:17 ` Szabolcs Nagy
2016-12-14 22:37 ` A. Wilcox
2016-12-15 2:30 ` Rich Felker
2016-12-15 4:01 ` A. Wilcox
2016-12-15 11:30 ` Szabolcs Nagy
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=CANEVyjtv7+kqyDjyYiSv7yq7YLvvJo9Ti0PSGcjQ3dVMgjqF1w@mail.gmail.com \
--to=nyh@scylladb.com \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).