[patch 2/2] Wrap-up expression support for DFP.

Eli Zaretskii eliz@gnu.org
Sat Dec 29 11:21:00 GMT 2007


> From: Thiago Jung Bauermann <bauerman@br.ibm.com>
> Cc: gdb-patches@sourceware.org
> Date: Wed, 26 Dec 2007 19:41:17 -0200
> 
> Actually, these numbers refer to the double representation in the target
> system, not to the decimal float representation used in libdecnumber. By
> the way, since libiberty also has an implementation for asprintf, I
> could do away with these estimates and just use this function instead.
> 
> > > +  /* We cannot use snprintf here because it is defined only in C99.
> > 
> > We have portable substitutes for snprintf, I think.  Take a look at
> > libiberty, for example.
> 
> Yes, it is there. I didn't find any .h, though, so I don't really know
> the proper way to use them.

There's include/libiberty.h, where all libiberty functions are
declared, conditioned by corresponding preprocessor defines.  Those
preprocessor defines should be defined by the configure script for
platforms that don't have those functions in their native libraries.

> > > +  /* This is an ugly way to do the conversion, but libdecnumber does
> > > +     not offer a direct way to do it.  */
> > > +  decimal_to_string (from, len, buffer);
> > > +  return atof (buffer);
> > 
> > Isn't strtold better here?
> 
> It's C99 and not in libiberty.

Then how about using strtod?



More information about the Gdb-patches mailing list