From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10794 Path: news.gmane.org!.POSTED!not-for-mail From: "Nadav Har'El" Newsgroups: gmane.linux.lib.musl.general Subject: Handling of L and ll prefixes different from glibc Date: Wed, 14 Dec 2016 15:46:40 +0200 Message-ID: Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=94eb2c04566c11be8e05439e9145 X-Trace: blaine.gmane.org 1481723219 11281 195.159.176.226 (14 Dec 2016 13:46:59 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Dec 2016 13:46:59 +0000 (UTC) Cc: "Nadav Har'El" To: musl@lists.openwall.com Original-X-From: musl-return-10807-gllmg-musl=m.gmane.org@lists.openwall.com Wed Dec 14 14:46:55 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cH9tU-00022a-4V for gllmg-musl@m.gmane.org; Wed, 14 Dec 2016 14:46:52 +0100 Original-Received: (qmail 19701 invoked by uid 550); 14 Dec 2016 13:46:54 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 19668 invoked from network); 14 Dec 2016 13:46:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scylladb-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to:cc; bh=NXuOfFze6ys605uVaRgWfquGZ8ZCbbycZSMFIoKJ3AA=; b=q0XiHmX10/eS1THPwFma3SWjTprNqHwB9z7zb43NU66tniUS8PKk7VdV9FFPSm3PHH 235Vvv2V+cEqg15UYs8aBgJpEbUUCS1nrwSi9E4AOMwBOh+tQ0EiVTa1kg5ff6v7Jro/ cq845n9feZQTYqu6JtQDWZqXqfF9UafMfuwqnE+hLP49ZrHvKTlV1gCLVb7JBK9uqcpo eyoYTI0TR+gyTBfo07l9bDYtG9BoxbYBvSybmpP9/6i6zSjPUmd2V5MUyHuGlCw5sQ4T BBTdvX2qMSiWpcccuwVdJYcZ26N5JQSfVKJrrrxJcsMBnYe4jEEPUja0foyqJ/86XZJl 4MgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=NXuOfFze6ys605uVaRgWfquGZ8ZCbbycZSMFIoKJ3AA=; b=NlGekwW3pARd3Hx/jRvaiGU1CiqWr9u6WjgPzgOJ/uo32TYlPXdi5DY3UYHao6CGPg B4icz2PxZ9HiD8PcbUvCmYEqrBO4QAL34T84vCEyVuA58r7RBOClY07o35wbFg3rckkG YMw4015EkfXZ1KhdK/eFbBVHz7P4EhNfemlAhu+WnsGAdOkTSJuYlBZFndKDKOjX9Q2t rDz0v6gUlScFFFglXkljCR/eNTcsaFrIaoQOCu0MbN36m6bdxGTEHZ1qHjBU7wMh99xD Tqql2VnOHCOD7QZA5ATOA1YJ3TucBZCjA5gd00w/4/VxQoxV8j2MKt7a/kSZlCZroGFv mV5A== X-Gm-Message-State: AKaTC00JY2SHtf+hYozZNSkT9wVNpQMADaYoBblkRaBBrprLzb0qSlZYxsRg6wl33bJBggckdynJIrY0Iz+VfS0d X-Received: by 10.233.216.7 with SMTP id u7mr31759908qkf.220.1481723201299; Wed, 14 Dec 2016 05:46:41 -0800 (PST) Xref: news.gmane.org gmane.linux.lib.musl.general:10794 Archived-At: --94eb2c04566c11be8e05439e9145 Content-Type: text/plain; charset=UTF-8 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 --94eb2c04566c11be8e05439e9145 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

Posix's printf manual sugge= sts (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 t= ype. And it seems that indeed, this is what Musl's printf() supports - = the test program

=C2=A0=C2=A0=C2=A0 long double d =3D 123.456;
= =C2=A0=C2=A0=C2=A0 printf("Lf: %Lf\n", d);
=C2=A0=C2=A0=C2=A0= printf("llf %llf\n", d);
=C2=A0=C2=A0=C2=A0 long long int i = =3D 123456;
=C2=A0=C2=A0=C2=A0 printf("Ld: %Ld\n", i);
=C2= =A0=C2=A0=C2=A0 printf("lld: %lld\n", i);
=C2=A0
produces with Musl's printf just two lines of output:

=C2=A0= =C2=A0=C2=A0 Lf: 123.456000
=C2=A0=C2=A0=C2=A0 lld: 123456

=
The two other printf()s (wi= th %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:

=C2=A0=C2=A0=C2=A0 Lf: 123.456000
=C2=A0= =C2=A0=C2=A0 llf 123.456000
=C2=A0=C2=A0=C2=A0 Ld: 123456
=C2=A0=C2= =A0=C2=A0 lld: 123456

If Musl's intention is to be co= mpatible with glibc, not Posix, I guess this behavior should be fixed, and = LL and ll should become synonyms, not different flags?

Th= anks,
Nadav.

--
Nadav Har'= ;El
nyh@scyl= ladb.com
--94eb2c04566c11be8e05439e9145--