Xref: utzoo comp.lang.c:26460 comp.sys.ibm.pc.programmer:191 Path: utzoo!utgpu!watserv1!watmath!maytag!xenitec!timk From: timk@xenitec.on.ca (Tim Kuehn) Newsgroups: comp.lang.c,comp.sys.ibm.pc.programmer Subject: Re: Floating Point Formates Summary: Overly Zealos Optimizing Linker strikes again! Keywords: scanf, atof, floating point Message-ID: <1990Mar1.232506.3684@xenitec.on.ca> Date: 1 Mar 90 23:25:06 GMT References: <1990Feb28.210122.24511@xenitec.on.ca> Reply-To: timk@xenitec.UUCP (Tim Kuehn) Distribution: na Organization: XeniTec Consulting Services, Kitchener, ON, Canada Lines: 43 In article <1990Feb28.210122.24511@xenitec.on.ca> timk@xenitec.UUCP (Tim Kuehn) writes: >I'm working on a program and am having a problem with the atof() function. >Every time I run it with a certain option turned on I get an error: >scanf : floating point formats not linked. > >The following code sample generates the same error. I've RTFM'd and there's >not a HINT of anything else that should be brought in in terms of > declerations, etc. > >Anybody have any ideas? > >-------code sample here------- >#include >#include >#include > >char arg[10]; >main() >{ >clrscr; >printf("start \n"); >strcpy(arg, "-f3"); >printf("%s \n", arg); >printf("%lf \n", atof(&arg[2])); >} > I've gotten a number of replies on this one, and it seems that TC 2.0 has a problem of being TOO zealous in optimizing spacewise, namely in that it optimizes links to the floating point emulation pkg right out if it doesn't see something like i9 = exp(1.0); or any other mathematical type equation in the program. (Use of the atof() function doesn't count as a mathematical function requiring floating point evidently) Thanks to all those who wrote, adding the above line (and a double i9 declaration) fixed the problem quite nicely. +-----------------------------------------------------------------------------+ |Timothy D. Kuehn timk@xenitec.on.ca | |TDK Consulting Services !watmath!xenitec!timk | |871 Victoria St. North, Suite 217A | |Kitchener, Ontario, Canada N2B 3S4 (519)-741-3623 | |DOS/Xenix - SW/HW. uC, uP, DBMS. Quality SW Guaranteed | +-----------------------------------------------------------------------------+