Nasty bug

Larry Jones scjones at thor.UUCP
Wed Sep 5 00:25:14 AEST 1990


In article <RICHARD.90Sep3115406 at orange.iesd.auc.dk>, richard at iesd.auc.dk (Richard Flamsholt S0rensen) writes:
>   Nope. ANSI states, that floats remain floats unless the expression
> contains more precise types, that is long double or double, in which
> case the float in converted. Therefore, if the float is the only
> parameter to a function it is *not* converted to a double in the
> expression, regardless of how the function was declared.

No, you've confused the "Usual Arithmetic Conversions" with the
"Default Argument Promotions".  The Usual Arithmetic Conversions
are the rules that you state -- float stays float.  Note, however,
that the compiler is usually allowed to get better results than
you might expect, so the old promotion to double is still allowed.

When calling a function which does not have a prototype in scope,
however, the Default Argument Promotions are applied to each of
the arguments.  These rules state that the normal Integral
Promotions are performed and that all floats are converted to
double, just like always.
----
Larry Jones                         UUCP: uunet!sdrc!thor!scjones
SDRC                                      scjones at thor.UUCP
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150-2789             AT&T: (513) 576-2070
When you're SERIOUS about having fun, it's not much fun at all! -- Calvin



More information about the Comp.lang.c mailing list