How to enable floating point library binding in TurboC?

I'm new to C ... Just want to ask how to enable floating point library binding in TurboC?

+3
source share
1 answer

From the frequently asked questions comp.os.msdos.programmer :

"Floating point formats are not related" Borland time error (Borland C or C ++, Turbo C or C ++). Borland compilers try to be smart, not links in a floating point library (fp) if you don't need it. Alas, they all get the decision erroneously. One common case where you do not call fp functions, but you have %feither another fp in scanf()or printf()calls. The cure is to call fp functions, or at least force it to be present in the link.

To do this, define this function somewhere in the source file, but do not name it:

static void forcefloat(float *p)   
{
     float f = *p;
     forcefloat(&f);    
}

It should not be in the module with the main program, if it is in the module that will be included in the link.

+5
source

All Articles