I managed to compile g_ascii_strtod() in my own code.
I obtain the same result though. I use another function
that I want to look how it is coded and it is the
function g_ascii_isdigit(). I have searced for it in
glib-2.12-9 but I didn't find it...
/Magnus


On Wed, 5 Sep 2007 00:47:36 +0200
David Nečas (Yeti) <[EMAIL PROTECTED]> wrote:

> On Tue, Sep 04, 2007 at 11:55:58PM +0200, Magnus Myrefors wrote:
> > 
> > I tried with strtod() but it only worked with strings with no
> > decimal-point, otherwise the resulting double was truncated.
> > ...
> > > - if the numbers are normal, i.e. supported by underlying
> > >   strtod(), try to use it directly -- be careful with the
>                                           ^^^^^^^^^^^^^^^^^^^
> > >   locale in this case
>       ^^^^^^^^^^^^^^^^^^^
> 
> strtod() is locale dependent, g_ascii_strtod() is not (well,
> sort of, it uses strtod() so if the locale or strtod()
> implementation is weird, g_ascii_strtod() can be still
> affected).  This is what g_ascii_strtod() is all about.
> Your locale uses decimal comma or something like that.  As
> if I didn't warn...
> 
> > I also tried to copy g_ascii_strtod() (from glib-2.12-9) into
> > my code but it didn't compile
> 
> My crystal ball says you are missing
> 
>   #include <locale.h>
> 
> but it's a bit cloudy.
> 
> > and I didn't quite understand
> > the if-statement if(decimal_point_pos) {} where decimal_point_pos
> > was declared as const char *decimal_point_pos.
> > I thought that a pointer was an address in memory and I haven't
> > seen a pointer in a if-statement like that before.
> 
> That's a common idiom.  NULL is zero and zero is false.
> Anything else is nonzero and therefore true.
> 
> > I guess I have to write my own conversion-function.
> 
> Good luck with that (I still think a bug in the program and
> not in GLib is the most probable cause).
> 
> Yeti
> 
> --
> http://gwyddion.net/
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to