[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: format is locale aware
From: |
Bruno Haible |
Subject: |
Re: format is locale aware |
Date: |
Tue, 08 Jun 2021 18:16:05 +0200 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-210-generic; KDE/5.18.0; x86_64; ; ) |
Hi Eric,
> However, as previous versions of m4 were NOT locale-aware, enabling
> locale support on what was supposed to be a minor release feels
> awkward
Yes; it can break some existing scripts that invoke m4.
> > If no, the fix would be in main.c: Add a
> > setlocale (LC_NUMERIC, "C");
> > after setlocale (LC_ALL, "").
>
> Or to use gnulib c-strtod and c-vasnprintf modules.
Well, c-strtod.c spends some time switching the locale. If the program
does not contain any other uses of the LC_NUMERIC category of the locale
(and this will also remain true in future versions of m4), it is more
efficient to switch the LC_NUMERIC category to "C" once and for all.
c-vasnprintf, OTOH, is just as efficient as vasnprintf.
Bruno