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 RAA28183; Mon, 14 Jun 2004 17:24:06 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA28842; Mon, 14 Jun 2004 17:24:05 +0200 (MET DST) Received: from smtp.mbg.ocn.ne.jp (mbg.ocn.ne.jp [210.190.142.181]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i5EFO3SH014076; Mon, 14 Jun 2004 17:24:04 +0200 Received: from localhost (p24061-adsau14honb7-acca.tokyo.ocn.ne.jp [220.111.74.61]) by smtp.mbg.ocn.ne.jp (Postfix) with ESMTP id 1C17B6456; Tue, 15 Jun 2004 00:24:02 +0900 (JST) Date: Tue, 15 Jun 2004 00:23:47 +0900 (JST) Message-Id: <20040615.002347.94548124.yoriyuki@mbg.ocn.ne.jp> To: xavier.leroy@inria.fr Cc: sjah@land.ru, caml-list@inria.fr Subject: Re: [Caml-list] string_of_float -> float_of_string locale dependency bug From: Yamagata Yoriyuki In-Reply-To: <20040614115444.A14769@pauillac.inria.fr> References: <20040614115444.A14769@pauillac.inria.fr> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40CDC313.001 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 yamagata:01 yoriyuki:01 yoriyuki:01 caml-list:01 locale:01 bug:01 2004:99 runtime:01 setlocale:01 setlocale:01 invalidate:01 camomile:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: Xavier Leroy Subject: Re: [Caml-list] string_of_float -> float_of_string locale dependency bug Date: Mon, 14 Jun 2004 11:54:44 +0200 > The Caml runtime system does depend on the LC_NUMERIC locale begin set > to its default value "C", but it ensures that this is the case by never > calling setlocale(LC_ALL, "") nor setlocale(LC_NUMERIC, ""). > > Third-party libraries can invalidate this invariant by calling e.g. > setlocale(LC_ALL, ""). Two possibilities: Or applications which run ocaml script internally, which become common recently. Assuming a particular locale is quite problematic. > > - The library doesn't really need LC_ALL, e.g. it would be enough > to set LC_CTYPE or LC_COLLATE and leave LC_NUMERIC unchanged. > In this case, the library should be fixed. > > - The library really needs to set LC_NUMERIC, in which case it's > impossible to use that library with the Caml toplevel. 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. > 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? -- Yamagata Yoriyuki ------------------- 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