how has C bitten you?
Henry Spencer
henry at utzoo.UUCP
Thu Aug 15 03:46:17 AEST 1985
> I thought that the implicit promotion of float to double on passing
> an argument was one of the things that was going away with the
> new C standard. ...
Not quite. Making it go away would break many, many programs. What has
actually happened is a bit more complex. Implicit float->double in most
contexts is now at the compiler's discretion, i.e. a compiler for a Cray
would probably opt to do it only if asked. Function calls are messier.
If there's a function prototype in scope, then conversions get done to the
types in the prototype, so your function prototypes can all just say "float"
for the parameters in question and there will be no implicit widening to
double. If there is *no* function prototype in scope, or if the prototype
ends with the "..." syntax for a variable-length argument list, then the
old behavior still applies and floats widen to double.
--
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,linus,decvax}!utzoo!henry
More information about the Comp.lang.c
mailing list