The bug in Turbo C 2.0

John Weeks weeks at ssbell.IMD.Sterling.COM
Sat Mar 17 05:56:43 AEST 1990


In article <1990Mar14.174620.11101 at metro.ucc.su.OZ.AU! chii at ee.su.oz.au (Liang Chii			) writes:
!I found a bug in Turbo C, please reconfirm if it is truely a bug.
!======= cut here =======
!#include <stdio.h!
!#include <alloc.h!
!
!main() {
!float far *temp, fix;
!int i;
!
!temp = farmalloc(40);
!for(i = 0; i< 5; i++)
!scanf("%f", temp+i);
!}
!===== end here ======
!
!The above code does not work but with an error message :
!"floating point formats not linked"

Its a fact that the Turbo C linker doesn't link in the floating
point routines if it doesn't think they are needed.  So in some
circumstances you have to force them to be linked in by making
an appropriate reference.  I think just declaring a dummy function
call will work:   void dummy(float a);

(Its a bug if they want to fix it, a feature if they don't. :-)

                          -jw-
-- 

John Weeks                                    Phone:  (402) 291-8300
Sterling Software FSG/IMD        e-mail: uunet!ssbell!weeks
1404 Ft. Crook Rd. South         e-mail: weeks at ssbell.IMD.Sterling.COM



More information about the Comp.lang.c mailing list