| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | float error |
G'Day Paul,
I've found it, here it is.
PRODUCT : C++ NUMBER : 645
VERSION : All
OS : DOS
DATE : September 18, 1991 PAGE : 1/2
TITLE : Floating Point Formats Not Linked
What is the floating point emulator and when is it used?
The floating point emulator is used to manipulate floating point
numbers in runtime library functions like scanf() and atof().
What causes the error?
When parsing your source file, if the compiler encounters a
reference to the address of a float, it sets a flag to have the
linker link in the floating point emulator. There are some cases
in which the reference to the float is a bit obscure and the
compiler does not detect the need for the emulator. The most
common is using scanf() with a pointer to a struct containing a
float.
For example:
struct foo
{
float fvar;
};
void main(void)
{
struct foo s1, *s2 = &s1;
scanf("%f", &s1->fvar);
}
These situations usually occur during the initial stages of
program development. Normally, once the program is fully
developed, the emulator will be used in such a fashion that the
compiler can accurately determine when to link in the emulator.
How can I force the formats to be linked?
To force linking of the floating point emulator to be linked into
an application, just include the following function in your
program:
void LinkFloat (void)
{
float a=0, *b=&a; /* cause emulator to be linked */
a=*b; /* suppress warning var not used */
}
You do not need to call this function, just include it anywhere
in your program. Once your project has reached its full size,
you will most likely be able to remove it from the program.
When will this be changed?
There are no current plans to change the inner workings of the
compiler because the intent is to avoid linking the floating
point emulator (about 1k of overhead) when it is not required.
Special Cases
An exception to this rule occurs with Turbo C version 2.01 when
using the atof() function. This is a mistake and is fixed in a
patch file called tc21pt.arc, which is available on CompuServe in
forum BPROGB, LIB 5. It is also available for download on the
Borland BBS which can be reached at 408.439.9096.
Are they kidding ? All this because of 1K overhead, and later they bring
out BC4 which by default links in a 20odd K runtime module ?
L8r Frank(fadam{at}ozemail.com.au)
___ Blue Wave/DOS v2.21
--- Maximus 3.01
* Origin: The Software Parlour (3:635/544)SEEN-BY: 50/99 620/243 623/630 632/349 635/503 544 727 711/401 409 410 413 SEEN-BY: 711/430 808 809 932 934 712/515 713/888 714/906 800/1 @PATH: 635/544 50/99 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.