Mail Archives: djgpp/1994/07/12/14:14:53
>
> Antonio Carlos M. de Queiroz writes:
> > Why gcc prints warnings when I use %lf, %le, and %lg formats to
> > print doubles?
>
> With printf, the "l" modifier is used only to specify "long integer"
> vs. "integer". An "l" before any thing other than "d", "i", "o", "u",
> "x", or "X" (or "n"?) is ignored. This is the warning you are getting.
> Floating point numbers passed to printf are already assumed to be
> doubles; they are automatically promoted from float to double when
> passed, if necessary.
>
> This is different than scanf, which assumes "float" and requires an
> "l" to specify "double".
> --
Hey, that's interesting :
o I use as well %lf in printf (and gcc) since it is the only way
to get all the digits when printing a double. %f only returns a
few. I don't get a warning!
o use of %lf etc with (f)printf (and (f)scanf) are described in K&R,
so there shouldn't be a warning (I don't get one anyway) and the
behavior I get from gcc is exactly in agreement with K&R.
Leendert
- Raw text -