Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] string_of_float -> float_of_string locale dependency bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Yamagata Yoriyuki <yoriyuki@m...>
Subject: Re: [Caml-list] string_of_float -> float_of_string locale dependency bug
From: Xavier Leroy <>
Subject: Re: [Caml-list] string_of_float -> float_of_string locale dependency bug
Date: Mon, 14 Jun 2004 17:58:22 +0200

> > Camomile needs to set LC_ALL to acquire LC_NUMERIC value.  Camomile
> > does not use LC_NUMERIC value currently, but it provides API to
> > getting all LC_* values for the user.
> Fine.  So what about restoring LC_NUMERIC after getting its value, like you
> helpfully suggest that the Caml run-time system does?

Because I did not aware that this causes a problem.  I will do
something to fix this problem.

> > > The C library API for internationalization is largely broken, and as
> > > you can see there is nothing we can do to work around the fact that
> > > the current locale is a global variable for the whole program.
> > 
> > You can temporally save the current LC_NUMERIC value, change its value
> > to C, and restore the value after the conversion.  What is a problem?
> Speed.  setlocale() is quite expensive, and string <-> float
> conversions can be extremely frequent.

Then, how about wrapping the entire ocaml-runtime by this "locale-free
zone"?  C primitives would be executed in "C" locale, but let them
have an access to the saved locale and temporarily revert back to the
original locale.

Yamagata Yoriyuki

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: