Date: Tue, 14 Jun 1994 12:59:31 +0200 (CED) From: David Svensson Subject: Re: using scanf to read long double? To: "Grzegorz B. Mazur" Cc: djgpp AT sun DOT soe DOT clarkson DOT edu On Tue, 14 Jun 1994, Grzegorz B. Mazur wrote: > > First, the compiler has NO RIGHT to check the args for scanf, because it > doesn't know what is scanf, and how the format string for it should look. GNU's gcc, and therefore DJGPP, is in fact capable of checking the parameters to scanf, printf and their likes. When invoked with the -Wformat option gcc will treat them as special keywords and check for correct parameters. > I am not quite sure if GCC supports long double on 386 (80 bits is not > a very typical format...) 80 bits is in fact one of the most commonly used floating point sizes of the 387. That is, 64 bits mantissa and the rest is the exponent. > - it can be treated as double. If this is the case, > everything works OK... Unfortunately this isn't the case. DJGPP uses a 53 bit mantissa for double and a 64 bit mantissa for long double. This is unfortunate since I'm porting an application from Turbo C, which allows scanf("%Lf",&my_long_double). The added precision is really needed. Looks like I'll have to write my own long double parser. Sigh... David