Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rutgers!sri-spam!ames!ucbcad!ucbvax!hplabs!hpcea!hpsrla!hpsrlc!darrylo
From: darrylo@hpsrlc.HP.COM (Darryl Okahata)
Newsgroups: comp.sys.ibm.pc
Subject: Re: Another TURBO C Bug??
Message-ID: <3320030@hpsrlc.HP.COM>
Date: Tue, 7-Jul-87 11:26:07 EDT
Article-I.D.: hpsrlc.3320030
Posted: Tue Jul  7 11:26:07 1987
Date-Received: Sat, 11-Jul-87 04:26:58 EDT
References: <1236@ihlpm.ATT.COM>
Organization: Network Measurements Div - Santa Rosa, CA
Lines: 52

In comp.sys.ibm.pc, kmh@ihlpm.ATT.COM (Kirk Hoyer) writes:

> Paul Chisholm correctly pointed out to me that, according to K & R section
> 2.7, floats are cast to doubles when used as function arguments. Many
> thanks to Paul for his observation. (I should note that the "cc" compiler 
> on the large UNIX system I use at work was able to handle the program correctly, 
> even though floats and double are different sizes.)
> 
> This explains the first problem cited in my posting, but not the second.
> I will try to provide a more concrete example of this problem in a future
> posting.
> 
>                                       Kirk Hoyer
> ----------

     I've heard that Turbo C WILL pass a float as a float (NOT as a double)
if function prototyping is used.  For example:

	foo(xyzzy)
	float	xyzzy;
	{
	...
	}

	main()
	{
		foo(42.0);
	}

will have a (double) (42.0) passed to foo().  However, if the following is
used:

	foo(float xyzzy)
	{
	...
	}

	main()
	{
		foo(42.0);
	}

a (float) (42.0) will be passed to foo().  No conversion is done in this
case.  Is this ANSI C???

     -- Darryl Okahata
	hplabs!hpcea!hpsrla!darrylo
	CompuServe: 75206,3074

Disclaimer: the above is the author's personal opinion and is not the
opinion or policy of his employer or of the little green men that
have been following him all day.