Jonathan Wakely wrote, on 19 Aug 2024:
>
> On Fri, 16 Aug 2024 at 10:37, Corinna Vinschen via austin-group-l at
> The Open Group <[email protected]> wrote:
> >
> > On Aug 16 16:53, Thomas Munro via austin-group-l at The Open Group wrote:
> > > Hello,
> > >
> > > I am aware of two thread-safe localeconv() alternatives in the wild:
> > >
> > > 1. glibc has nl_langinfo_l(DECIMAL_POINT, loc) for
> > > localeconv()->decimal_point, and so on for every member of struct
> > > lconv.
> >
> > nl_langinfo_l is also implemented in newlib and thus Cygwin since 2016.
>
> nl_langinfo_l is in POSIX, but glibc adds constants like DECIMAL_POINT
> for all the lconv members. Those aren't required by POSIX, and don't
> seem to be present in newlib.
In glibc, DECIMAL_POINT is just a non-standard synonym for RADIXCHAR
which is the langinfo.h constant POSIX requires for obtaining the decimal
point character. It has a similar non-standard synonym for THOUSEP:
enum {
[...]
__DECIMAL_POINT = _NL_ITEM (__LC_NUMERIC, 0),
#ifdef __USE_GNU
# define DECIMAL_POINT __DECIMAL_POINT
#endif
RADIXCHAR = __DECIMAL_POINT,
#define RADIXCHAR RADIXCHAR
__THOUSANDS_SEP,
#ifdef __USE_GNU
# define THOUSANDS_SEP __THOUSANDS_SEP
#endif
THOUSEP = __THOUSANDS_SEP,
#define THOUSEP THOUSEP
[...]
};
--
Geoff Clare <[email protected]>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England