Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: HELP! Need *detailed* list of Microsoft C 5.1 -> 6.0 changes Keywords: Silent introduction of BUGS Message-ID: <788@taumet.com> Date: 29 Jun 91 14:49:32 GMT References: <1991Jun28.030934.10935@Octopus.COM> <1991Jun28.124443.27333@cs.odu.edu> Organization: Taumetric Corporation, San Diego Lines: 22 kremer@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@taumet.com