This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [RFC] PR 6015: number formatting is not mt-safe
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: Paolo Carlini <pcarlini at unitus dot it>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Fri, 22 Mar 2002 17:45:53 -0800 (PST)
- Subject: Re: [RFC] PR 6015: number formatting is not mt-safe
It would be like this.
template<typename _Tv>
int
__convert_from_v(char* __out, const int __size, const char* __fmt,
_Tv __v, const __c_locale& __cloc, int __prec = -1)
{
int __ret;
__c_locale __old = __uselocale(__cloc);
if (__prec >= 0)
__ret = snprintf(__out, __size, __fmt, __prec, __v);
else
__ret = snprintf(__out, __size, __fmt, __v);
__uselocale(__old);
return __ret;
}
There are more hooks for this kind of functionality in the config/locale/gnu.
-benjamin