[RFC] PR 6015: number formatting is not mt-safe

Ulrich Drepper drepper@redhat.com
Fri Mar 22 17:53:00 GMT 2002


On Fri, 2002-03-22 at 17:45, Benjamin Kosnik wrote:

>   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;
>     }

It's not obvious from this, but the code above is thread-safe.  See

  http://www.cygnus.com/~drepper/tllocale.ps.bz2

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20020322/8058ee66/attachment.sig>


More information about the Libstdc++ mailing list