Steffen Nurpmeso wrote, on 24 May 2022:
>
>   I find that "setlocale() may invalidate the string" painful,
>   because many functions of the C library do not have _l() variants
>   that could work with a uselocale() object.  Just think about the
>   scanf() that is used so often, or strtol(): you cannot even
>   convert a number by standard means.

You are mixing up uselocale() and newlocale().

The _l() functions and uselocale() are different ways to make use
of a locale object obtained from newlocale().

If there is no _l() function, you can pass the locale object to
uselocale() to set a thread-local current locale which must then
be used by functions that use the current locale, such as scanf()
and strtol().  These functions only use the "global locale" (set
by setlocale()) if there is no thread-local current locale set.

-- 
Geoff Clare <g.cl...@opengroup.org>
The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England

      • Re: POSIX b... Steffen Nurpmeso via austin-group-l at The Open Group
        • Re: POS... Harald van Dijk via austin-group-l at The Open Group
          • Re:... Steffen Nurpmeso via austin-group-l at The Open Group
            • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Steffen Nurpmeso via austin-group-l at The Open Group
              • ... Harald van Dijk via austin-group-l at The Open Group
              • ... Steffen Nurpmeso via austin-group-l at The Open Group
              • ... Steffen Nurpmeso via austin-group-l at The Open Group
  • Re: POSIX bind_textd... Geoff Clare via austin-group-l at The Open Group
    • Re: POSIX bind_... Steffen Nurpmeso via austin-group-l at The Open Group
      • Re: POSIX b... Geoff Clare via austin-group-l at The Open Group
        • Re: POS... Steffen Nurpmeso via austin-group-l at The Open Group
    • Re: POSIX bind_... Bruno Haible via austin-group-l at The Open Group

Reply via email to