From: Eric Backus Subject: Re: Interrupt 33 and format warnings To: combee AT cambridge DOT scr DOT slb DOT com Date: Tue, 12 Jul 94 14:45:36 PDT Cc: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp) Mailer: Elm [revision: 70.85] Leendert Combee wrote: > 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! I believe you have to ask for the warning, with "-Wall" or the equivalent. A more portable way to get many digits is to specify how many digits you want, like this: printf("%.15f", mydouble); > 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. K&R version 1 on page 146 says: "A length modifier l (letter ell), which indicates that the corresponding data item is a long rather than an int." K&R version 2 on page 244 says: "A length modifier h, l (letter ell), or L. "h" indicates that the corresponding argument is to be printed as a short or unsigned short; "l" indicates that the argument is a long or unsigned long; "L" indicates that the argument is a long double." Under the floating point stuff, neither version mentions the "l" length modifier. The ANSI C spec says that the behavior of "l" is undefined except when used with "d", "i", "o", "u", "x", "X", and "n". The djgpp libc.a may be providing an extension to ANSI C by using "l" to mean print more digits, but it is not portable and is not ANSI C. -- Eric Backus ericb AT lsid DOT hp DOT com (206) 335-2495