scanf() problem in Turbo C++ 1.00 but NOT in Turbo C 2.01

J.D. Baldwin. baldwin at usna.NAVY.MIL
Thu Oct 11 11:55:43 AEST 1990


In article <344 at usna.NAVY.MIL> I, with brain engaged firmly in neutral, 
wrote:
[a bunch of code and text describing a problem in which]
>
>    scanf("%lf", &(ar_1[0]));
[resulted in]
>
>          scanf : floating point formats not linked
>          Abnormal program termination

Within hours, several people from across the nation answered me with
"Yeah!  I got something like that, too!  I dunno why."  This makes me
feel much better--I wasn't the only one who hadn't read the FAQ list
thoroughly recently.

It took a Mr. Karl Heuer, of Interactive Systems, Cambridge, MA to set me
straight by quoting, of all things, the FAQ list.  The perceptive Mr.
Heuer clearly knew that I must feel like a buffoon and kindly did not
dwell on my error.  I really *do* read these things.  I swear.

This one got by me.  It's worth repeating here for those others (and
now I know you're out there):

>65. I'm having trouble with a Turbo C program which crashes and says
>    something like "floating point not loaded."
>
>A:  Some compilers for small machines, including Turbo C and Ritchie's
>    original pdp11 compiler, attempt to leave out floating point support
>    if it looks like it will not be needed.  In particular, the non-
>    floating-point versions of printf and scanf save space by not
>    including code to handle %e, %f, and %g.  Occasionally the
>    heuristics for "is the program using floating point?" are
>    insufficient, and the programmer must insert one dummy explicit
>    floating-point operation to force loading of floating-point support.
>    Unfortunately, an apparently common sort of program (thus the
>    frequency of the question) uses scanf to read, and/or printf to
>    print, floating-point values upon which no arithmetic is done, which
>    elicits the problem under Turbo C.
>
>    In general, questions about a particular compiler are inappropriate
>    for comp.lang.c .  Problems with PC compilers, for instance, will
>    find a more receptive audience in a PC newsgroup.

Apologies to the net.  Thanks to Mr. Heuer.
--
 From the catapult of:              |+| "If anyone disagrees with anything I
   _, J. D. Baldwin, Comp Sci Dept  |+| say, I am quite prepared not only to
 __||____:::)=}-  U.S. Naval Academy|+| retract it, but also to deny under
 \      / baldwin at cad.usna.navy.mil |+| oath that I ever said it." --T. Lehrer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the Comp.lang.c mailing list