From owner-freebsd-arch Sun Jan 27 1:46:36 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mail.acns.ab.ca (mail.acns.ab.ca [142.179.151.95]) by hub.freebsd.org (Postfix) with ESMTP id E580E37B400; Sun, 27 Jan 2002 01:46:32 -0800 (PST) Received: from colnta.acns.ab.ca (colnta.acns.ab.ca [192.168.1.2]) by mail.acns.ab.ca (8.11.6/8.11.3) with ESMTP id g0R9kRV12912; Sun, 27 Jan 2002 02:46:27 -0700 (MST) (envelope-from davidc@colnta.acns.ab.ca) Received: (from davidc@localhost) by colnta.acns.ab.ca (8.11.6/8.11.3) id g0R9kQh40931; Sun, 27 Jan 2002 02:46:26 -0700 (MST) (envelope-from davidc) Date: Sun, 27 Jan 2002 02:46:26 -0700 From: Chad David To: "Andrey A. Chernov" Cc: "Brian F. Feldman" , Bruce Evans , arch@FreeBSD.ORG Subject: Re: strtod() Message-ID: <20020127024626.B40668@colnta.acns.ab.ca> Mail-Followup-To: "Andrey A. Chernov" , "Brian F. Feldman" , Bruce Evans , arch@FreeBSD.ORG References: <20020126162924.A7726@colnta.acns.ab.ca> <200201270453.g0R4rwi92912@green.bikeshed.org> <20020127070421.GA13415@nagual.pp.ru> <20020127003719.A38420@colnta.acns.ab.ca> <20020127083529.GA13957@nagual.pp.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020127083529.GA13957@nagual.pp.ru>; from ache@nagual.pp.ru on Sun, Jan 27, 2002 at 11:35:30AM +0300 Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Jan 27, 2002 at 11:35:30AM +0300, Andrey A. Chernov wrote: > On Sun, Jan 27, 2002 at 00:37:19 -0700, Chad David wrote: > > > is the first call to localeconv() that causes errno to be updated when > > it calls strtol(). After that localeconv() takes a short cut. So it > > It is because localeconv() cache its result. Yes, that is what I ment by "short cut" :). > > > isn't really strtod()'s problem, but localeconv()'s. > > It looks like it is not localeconv() problem, but incorrect locale > problem. Maybe, I don't really know much about the locale code, but it seems the default C monetary locale is all nulls. > > > The attached patch fixes this case, and probably others. Comments? > > Don't do that, fix locale instead. cnv() expected to be called on valid > numeric fields only. How would you fix it? I'm not sure errno should get modified just because a locale has an invalid entry? Do you fix the locale (if so how??), or do you make the code a little more robust? -- Chad David davidc@acns.ab.ca www.FreeBSD.org davidc@freebsd.org ACNS Inc. Calgary, Alberta Canada Fourthly, The constant breeders, beside the gain of eight shillings sterling per annum by the sale of their children, will be rid of the charge of maintaining them after the first year. - Johnathan Swift To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message