tech-userlevel archive

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

Re: Per thread locales

On Tue, Dec 29, 2015 at 01:35:16AM +0100, Joerg Sonnenberger wrote:
> There is a good reason why the C++ locale support doesn't use
> per-thread locales. They are still a pretty stupid idea.

You mean setting the locale explicitly per iostream?

> > However, this is not always trivial (when the code uses lots of deeply nested
> > library code) so patches are hard to verify and even harder to upstream.
> I contest that. So far, the majority of the code wanting to use
> uselocale always wanted the "C" locale. That's an audit of the locale
> sensitive code and not so much a question of nesting.

I don't understand. You have seen the Skia code - it is hard to audit in this
case and it is only about float number input/output for shaders.

> > A relatively simple & cheap hack would be a per-thread flag "override process
> > locale with C" and a uselocale() function that recognizes "C" and the
> > process locale and then sets/clears the flag accordingly, failing in all
> > other cases.
> This doesn't work well, consider ctype.h as example.

I don't understand this either.


Home | Main Index | Thread Index | Old Index