Microsoft KB Archive/57962

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:25, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q57962 to Microsoft KB Archive/57962 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

“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.