bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

POSIX gettext(): lifetime of returned values


From: Bruno Haible
Subject: POSIX gettext(): lifetime of returned values
Date: Thu, 12 May 2022 01:26:19 +0200

https://posix.rhansen.org/p/gettext_draft
Line 357

"The returned string may be invalidated by ... a subsequent call to
uselocale() in the same thread, except for calls that only query values."

As explained in my mail from 2021-05-04 [1]

   uselocale() is a helper function to implement *_l functions where
   the POSIX standard does not specify them or the system does not have
   them.
   For example, when a program wants to have a function to parse
   a number, recognizing only the ASCII digits and only '.' as decimal
   separator, a reliable way to implement such a function is by calling
   uselocale of the "C" locale, strtod(), and then uselocale() again
   to switch the thread back to the previous locale.

   If POSIX did not have uselocale(), it would need to provide many
   more *_l functions.

If temporarily switching a thread's locale through uselocale()
invalidates the gettext functions' results (even if only those from
the same thread), it effectively disallows uselocale() as a helper
function.

[1] https://lists.gnu.org/archive/html/bug-gettext/2021-05/msg00005.html






reply via email to

[Prev in Thread] Current Thread [Next in Thread]