Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Jan 2002 02:46:26 -0700
From:      Chad David <davidc@acns.ab.ca>
To:        "Andrey A. Chernov" <ache@nagual.pp.ru>
Cc:        "Brian F. Feldman" <green@FreeBSD.ORG>, Bruce Evans <bde@zeta.org.au>, arch@FreeBSD.ORG
Subject:   Re: strtod()
Message-ID:  <20020127024626.B40668@colnta.acns.ab.ca>
In-Reply-To: <20020127083529.GA13957@nagual.pp.ru>; from ache@nagual.pp.ru on Sun, Jan 27, 2002 at 11:35:30AM %2B0300
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>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020127024626.B40668>