- 论坛徽章:
- 0
|
原帖由 lenovo 于 2007-2-13 22:45 发表
用TC系统编写小程序时,如果程序里用到浮点输入,有时运行中会出现下面错误信息:
scanf : floating point formats not linked
Abnormal program termination
这个错误信息的意思是:scanf的浮点格式 ...
我原来一直猜测有命令行参数可以调整这种行为,但现在没有 TC 了,也试不了。不知到把优化参数去掉或加入调试参数后情况如何。
以下是 comp.lang.c FAQ 对这个问题的解释:
15.6: I'm having trouble with a Turbo C program which crashes and says
something like "floating point formats not linked."
A: Some compilers for small machines, including Turbo C (and
Ritchie's original PDP-11 compiler), 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. It happens that
Turbo C's heuristics for determining whether the program uses
floating point are insufficient, and the programmer must
sometimes insert an extra, explicit call to a floating-point
library routine to force loading of floating-point support.
现在的编译器不再有这种问题了。如果没有特别的理由,还是不要去折腾这些上了年纪的编译器啦,让它们安息吧。 |
|