Microsoft KB Archive/57962

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

“f” Is Not Handled Correctly by C 5.0/5.1 Preprocessor ID Number: Q57962

5.00 5.10 | 5.10 MS-DOS | OS/2 buglist5.00 buglist5.10 fixlist6.00

Summary:

When compiling with Microsoft C versions 5.0 or 5.1, the preprocessor does not keep “f” in the string if appended to a floating-point numeric constant in a #define statement.

Sample Code

  1. define FLOATONE 1.0f

float f1 = FLOATONE, f2 = 1.0f;

More Information:

The above example should compile cleanly. However, if compiled with the warning level set to 2 or higher, a type conversion warning will be generated at about the third line. If compiled with /E (preprocess to screen), the following output is observed:

float f1 = 1.0, f2 = 1.0;

The correct output from QuickC versions 2.0 and 2.01 is as follows:

float f1 = 1.0f, f2 = 1.0f;

Microsoft has confirmed this to be a problem in C versions 5.0 and 5.1. This problem was corrected in C version 6.0.