Re: New g_ascii_strtod/g_ascii_dtostr() patch



On Thu, 4 Oct 2001, Alex Larsson wrote:

> After a discussion with tim on irc yesterday i made some changes to the 
> patch. Here is a new version that keeps the old g_strtod() behaviour, and 
> adds the new g_ascii_ versions. I also changed the g_ascii_dtostr() API. 
> Now you can formate it differently if you want.
> 
> Jody told me on irc that gnumeric has had a lot of problems because 
> strtod() does not clear errno, so if you do stuff like
> 
> if (strtol ())
> 	strtod()
> 
> an ERANGE set by strtol is left even if strtod() succeeded.

unless you actually mean g_strtod() instead of strtod() here,
that's fine, since libc doesn't have to reset errno to 0 if
no error occoured.

for g_strtod(), i think we should really clear errno, since we invoke
multiple libc functions there and then pick the best result, so the
errno we'd return is probably wrong in half the cases anyway.

> He proposed that we should set errno to 0 in g_ascii_strtod(). What do 
> people think about this? Personally i don't like doing magic that makes 
> it behave in a way the standard call does.

for g_ascii_strtod(), we're pretty free to reset errno to 0, since
we're not 1:1 mimicking a libc function there.

> 
> / Alex
> 

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]