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 09:08:46AM +0100, Martin Husemann wrote:
> 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?

Correct, that works well and doesn't require uselocale in decent
implementation. I haven't double checked what libstdc++ is doing, but
that's a separate question.

> > > 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.

If it is using strtod or printf, use the _l version with LC_C_LOCALE for
locale_t. It is annoying to audit because approach taken by Skia
complete decouples getting the locale from using the locale...


Home | Main Index | Thread Index | Old Index