Re: RFC: Fix various problems with "printf" and warnings

Daniel Jacobowitz
2006-01-22T04:56:23Z

On Sun, Jan 22, 2006 at 06:28:05AM +0200, Eli Zaretskii wrote:
> > Date: Sat, 21 Jan 2006 19:31:17 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> >
> > + else if (*f == ' ')
> > + seen_space = 1;
> > + else if (*f == ' ')
> > + seen_plus = 1;
>
> A typo in the second "else if" clause.

Oops. Thank you.

> > + case long_double_arg:
> > +#ifdef HAVE_LONG_DOUBLE
> > + {
> > + long double val = value_as_double (val_args[i]);
> > + printf_filtered (current_substring, val);
>
> Won't `value_as_double' lose accuracy here, possibly catastrophically
> (i.e., a non-zero number coming out as zero, etc.)?

Not usually. value_as_double is somewhat misnamed; it returns a
DOUBLEST, which will be long double if the host supports long double.
Now, if the target has a long double with a greater precision (or just
different precision, due to different format) than the host long
double, this will lose out a bit. But this isn't the only place in GDB
that will lose in that case.