HELP! Need *detailed* list of Microsoft C 5.1 -> 6.0 changes

Stephen Clamage steve at taumet.com
Sun Jun 30 00:49:32 AEST 1991


kremer at cs.odu.edu (Lloyd Kremer) writes:

|I think I found one by accident.  Floats no longer automatically promote to
|doubles on evaluation.  Instead the resulting type depends on which type comes
|first in the SOURCE code!  For example:

|	float f;
|	double d;
|	sizeof(f + d) == 4

If this is true, it is a bug; it is not due to any ANSI rule.  The sizeof
operator is obliged to return the size of the type of its expression.
The type of 'f+d' is 'double', under ANSI C rules, or any other C rules.

In K&R C, floats were always promoted to doubles in any expression.  In
ANSI C the 'always' requirement is removed.  There are still rules which
require floats to be promoted to doubles.  If one operand of a binary
operator is a double, the other is promoted to double (unless it is a
already a long double).  This rule covers the given example.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.lang.c mailing list