lo:
Somebody not too long ago wrote asking about why a piece of code did not
work and how to fix it. They encountered runtime-floating point errors
that did not show up during compiling. This occurs when you do something
like this:
...
struct mypay {
char name[40];
float Pay;
};
struct mypay job;
scanf(" %f", &job.Pay);
...
Notice that the float was not initialized with anything. That's the
problem right there, MSVC and TURBO C++ and i'm not sure about
others...they only load the necessary compiler options that they
absolutely need. Since the float was not initialized, it basically does
not see the float as a float. therefore, it doesn't load the float
routines it needs. To fix this, simply initialize the offending arg.
...
struct mypay {
char name[40];
float Pay;
};
struct mypay job = {"xxx", 0.0F};
scanf(" %f", &job.Pay);
...
It should now see the var and work normally. Here is some more help if I
didn't explain your problem very clearly.
http://premium.microsoft.com/support/kb/articles/q37/5/07.asp
GoodLuck.
Baktor
+------------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
+------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/08/00 PST