mailing list of musl libc
 help / color / mirror / code / Atom feed
* Handling of L and ll prefixes different from glibc
@ 2016-12-14 13:46 Nadav Har'El
  2016-12-14 16:13 ` Rich Felker
  0 siblings, 1 reply; 7+ messages in thread
From: Nadav Har'El @ 2016-12-14 13:46 UTC (permalink / raw)
  To: musl; +Cc: Nadav Har'El

[-- 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 --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-12-15 11:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-14 13:46 Handling of L and ll prefixes different from glibc Nadav Har'El
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

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