Conversions/casts one more time

Kenneth R. Ballou ballou at brahms
Mon Dec 15 13:23:03 AEST 1986


In article <91 at ems.UUCP> mark at ems.UUCP (Mark H. Colburn) writes:
>I thought that K&R stated that type coersions did not occur when values were
>passed as parameters to a function.  If the compiler did do the coersion then
>it would have to keep track of the type of parameter that is exepected to be
>passed to the function, even though it may be in a different file, etc.

This is not true.  Note that the parameters to a function are expressions, and
there are standard unary conversions (also standard binary conversions) that
are applied to arithmetic types appearing in expressions.  The usual unary
conversions (defined in K&R) include widening char and short to int and float
to double.   These are applied to parameters in function calls and do not
depend on any declarations of the types of parameters.

--------
Kenneth R. Ballou			ARPA:  ballou at brahms
Department of Mathematics		UUCP:  ...!ucbvax!brahms!ballou
University of California
Berkeley, California  94720
--------
Kenneth R. Ballou			ARPA:  ballou at brahms
Department of Mathematics		UUCP:  ...!ucbvax!brahms!ballou
University of California
Berkeley, California  94720



More information about the Comp.lang.c mailing list