From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA12388; Mon, 14 Jun 2004 17:58:50 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA12096 for ; Mon, 14 Jun 2004 17:58:49 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i5EFwMEV005540; Mon, 14 Jun 2004 17:58:22 +0200 Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA13166; Mon, 14 Jun 2004 17:58:22 +0200 (MET DST) Date: Mon, 14 Jun 2004 17:58:22 +0200 From: Xavier Leroy To: Yamagata Yoriyuki Cc: sjah@land.ru, caml-list@inria.fr Subject: Re: [Caml-list] string_of_float -> float_of_string locale dependency bug Message-ID: <20040614175822.B28810@pauillac.inria.fr> References: <20040614115444.A14769@pauillac.inria.fr> <20040615.002347.94548124.yoriyuki@mbg.ocn.ne.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20040615.002347.94548124.yoriyuki@mbg.ocn.ne.jp>; from yoriyuki@mbg.ocn.ne.jp on Tue, Jun 15, 2004 at 12:23:47AM +0900 X-Miltered: at nez-perce with ID 40CDCB1E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 locale:01 bug:01 camomile:01 camomile:01 api:01 run-time:01 api:01 locale:01 temporally:01 setlocale:01 caml:01 conversions:02 float:02 float:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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? > > 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. - Xavier Leroy ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners