Re: locale, gui vs command line question?



On Mon, 1 Feb 2010, Freddie Unpenstein wrote:
On Sun, 31 Jan 2010, james morris wrote:
Why is store/change/restore of locale bad?

There's nothing at all wrong with it in the context you
specified -- i.e. you want to ensure that floating-point
values written to and read from file always use '.' as the
decimal separator. I do that in my app, gretl (also for
reasons of portability).

The problem would be the potential that the library may have
cached locale features under a different locale, wouldn't it?

A bigger problem is that setlocale() is non-local hence it breaks
anything asynchronous, namely threads.

It may not matter in a single-threaded program but it's something you
should never do in a library.

Yeti




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]