delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/07/12/14:14:53

From: combee AT cambridge DOT scr DOT slb DOT com (Leendert Combee)
Subject: Re: Interrupt 33 and format warnings
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Tue, 12 Jul 1994 18:20:39 +0100 (BST)

>
> 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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019