Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!brl-adm!rutgers!mit-eddie!genrad!decvax!ucbvax!cartan!brahms!ballou From: ballou@brahms (Kenneth R. Ballou) Newsgroups: comp.lang.c Subject: Re: Conversions/casts one more time Message-ID: <558@cartan.Berkeley.EDU> Date: Sun, 14-Dec-86 22:23:03 EST Article-I.D.: cartan.558 Posted: Sun Dec 14 22:23:03 1986 Date-Received: Tue, 16-Dec-86 19:07:55 EST References: <176@unisoft.UUCP> <820@mtund.UUCP> <179@unisoft.UUCP> <91@ems.UUCP> Sender: daemon@cartan.Berkeley.EDU Reply-To: ballou@brahms (Kenneth R. Ballou) Organization: Math Dept. UC Berkeley Lines: 23 In article <91@ems.UUCP> mark@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@brahms Department of Mathematics UUCP: ...!ucbvax!brahms!ballou University of California Berkeley, California 94720 -------- Kenneth R. Ballou ARPA: ballou@brahms Department of Mathematics UUCP: ...!ucbvax!brahms!ballou University of California Berkeley, California 94720