Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANEVyjtv7+kqyDjyYiSv7yq7YLvvJo9Ti0PSGcjQ3dVMgjqF1w@mail.gmail.com>
Date: Wed, 14 Dec 2016 15:46:40 +0200
From: "Nadav Har'El" <nyh@...lladb.com>
To: musl@...ts.openwall.com
Cc: "Nadav Har'El" <nyh@...lladb.com>
Subject: Handling of L and ll prefixes different from glibc

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@...lladb.com

Content of type "text/html" skipped

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.