[comp.lang.c++] TC++: "floating point formats not linked"

davem@hpmwtd.HP.COM (Dave McQuate) (02/13/91)

If you include in your program ANY explicit floating point calculations, that
should force the loader to include the FP routines.

kirste@methan.chemie.fu-berlin.de (Burkhard Kirste) (02/13/91)

>In TC++, running in "C" mode , the following code gives the error message:
>"scanf: floating point formats not linked"
>How do I link them?   (fp is a pointer to an open text file)
>                         
>                        float *w
>                        fscanf(fp,"%f\n",w);
>
>tom weston

I have found that a statement such as
               atof("");

would help. Anyway, I think that this "feature" of TC is a nuisance.
-- 
  |~|   Freie Universitaet Berlin, Institut fuer Organische Chemie
  / \   Burkhard Kirste    kirste@kristall.chemie.fu-berlin.dbp.de
 /FUB\  Takustrasse 3, D-1000 Berlin 33      UUCP: kirste@fub.uucp
 `---'  Telefon: (030)838-6484              Telefax: (030)838-5163

bright@nazgul.UUCP (Walter Bright) (02/24/91)

In article <LT5NQEC@methan.chemie.fu-berlin.de> kirste@methan.chemie.fu-berlin.de (Burkhard Kirste) writes:
/>In TC++, running in "C" mode , the following code gives the error message:
/>"scanf: floating point formats not linked"
/>How do I link them?
/>                        float *w
/>                        fscanf(fp,"%f\n",w);
/I have found that a statement such as
/               atof("");
/would help. Anyway, I think that this "feature" of TC is a nuisance.

In TC, the floating point library is only linked in if one of the OBJ files
for the program contained a floating point operation. This is nice because
if you don't use floating point you don't carry around the bulk of the library
code. The downside is this causes a significant burden on the tech support,
as I have seen this one problem appearing over and over again for *years*.

In ZTC, we use the opposite approach. Floating point is always linked in
by default. If you don't need it, then compile with -mi or link in the
INT.OBJ object module. The upside is we never get tech support calls like
the one above. The downside is many people never notice the -mi switch and
wind up thinking that ZTC generates unnaturally large EXE files. Even many
magazine reviewers have fallen into this error.

I'm all ears if anyone has a suggestion on how to get the best of both
by default.

harrison@necssd.NEC.COM (Mark Harrison) (02/27/91)

In article <268@nazgul.UUCP>, bright@nazgul.UUCP (Walter Bright) writes:

> In TC, the floating point library is only linked in if one of the OBJ files
> for the program contained a floating point operation.
 
> In ZTC, we use the opposite approach. Floating point is always linked in
> by default. If you don't need it, then compile with -mi or link in the
> INT.OBJ object module.

> I'm all ears if anyone has a suggestion on how to get the best of both
> by default.

Perhaps you could add some kind of informatory message at link time...

	"Linking floating point stuff, but don't see that you are
	 using any floating point in your program...  Use the -mi
	 option if you don't want floating point."

Of course, then you would need a linker option to suppress this
message :-(
-- 
Mark Harrison             harrison@necssd.NEC.COM
(214)518-5050             {necntc, cs.utexas.edu}!necssd!harrison
standard disclaimers apply...

ts@cup.portal.com (Tim W Smith) (02/28/91)

Walter Bright writes:
< I'm all ears if anyone has a suggestion on how to get the best of both
< by default.

Here's a horrible kludge idea: if the linker is linking without the
floating point libraries, have it start over with them included if
a link error is encountered.

By the way, are you the same Walter Bright who used to be at Caltech?

						Tim Smith

bright@nazgul.UUCP (Walter Bright) (03/12/91)

In article <39644@cup.portal.com> ts@cup.portal.com (Tim W Smith) writes:
/Walter Bright writes:
/< I'm all ears if anyone has a suggestion on how to get the best of both
/< by default.
/Here's a horrible kludge idea: if the linker is linking without the
/floating point libraries, have it start over with them included if
/a link error is encountered.

The "Floating point not loaded" is a runtime error message, not a link
time message.

/By the way, are you the same Walter Bright who used to be at Caltech?

I attended Caltech from 1975-79.

/						Tim Smith

I remember you too!