[RFC] PR 6015: number formatting is not mt-safe
Benjamin Kosnik
bkoz@redhat.com
Fri Mar 22 17:45:00 GMT 2002
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
More information about the Libstdc++
mailing list