C++ Logo

sg16

Advanced search

Re: [SG16] LWG issue: Time formatters should not be locale sensitive by default

From: Corentin <corentin.jabot_at_[hidden]>
Date: Sun, 2 May 2021 14:41:25 +0200
On Sun, May 2, 2021 at 1:44 PM Jens Maurer <Jens.Maurer_at_[hidden]> wrote:

> On 02/05/2021 12.52, Corentin via SG16 wrote:
> > There do not seem to be an end to the brokenness, which I guess is to be
> expected when dealing with POSIX
> > Reading of the code of strftime reveals that strftime never uses locale
> to format numbers without O, even if it should.
>
> You're talking about POSIX (a standard) here, and then about "reading the
> code",
> which seems to refer to a specific implementation.
>

I tried to infer one from the other, I found POSIX to be ambiguous at best

https://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html
https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html#tag_07_03_05
(for
alt_digits)
https://pubs.opengroup.org/onlinepubs/000095399/basedefs/xbd_chap07.html (for
digits)


The code I was referring at was that of glibc, which I meant to provide a
link for
https://code.woboq.org/userspace/glibc/time/strftime_l.c.html#90do_number (for
reference).
I also tried the libc available on mac which is not glib and it exposes the
same behavior.


>
> Are you saying that the POSIX standard prescribes to ignore the locale
> for non-O format specifiers, or are you saying that the specific
> implementation you looked at ignores the locale for non-O
> specifiers, presumably in violation of the POSIX standard?
>
> Talking about the POSIX standard


> > In fact, it never uses the digits property at all! Neither does printf
>
> The POSIX standard or the implementation you looked at?
>

POSIX - very explicitly in this case
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap05.html#tag_05




>
> Jens
>

Received on 2021-05-02 07:41:39