Prototypes with old style definitions

Mark H. Colburn mark at Jhereg.Minnetech.MN.ORG
Wed Feb 14 00:35:03 AEST 1990


In article <2329 at dataio.Data-IO.COM> bright at Data-IO.COM (Walter Bright) writes:
>In article <626 at cameron.cs.duke.edu> amr at dukee.egr.duke.edu (Anthony M. Richardson) writes:
<<	float foo(float, int);
<<
<<	float foo(x, n)
<<	float x;
<<	int n;
<<	{ ......... }
<"Syntax error!" But seriously, the second definition is equivalent to:
<
<	float foo(tmp,n)
<	double tmp;
<	int n;
<	{	float x = tmp;
<		....
<	}


I was under the impression that the standard allowed parameters to be
passed between functions without type coersion in this manner as long
as there was a function prototype in effect.  If no function prototype
is in effect then the second example would be correct.  However, using
prototypes, the former should be correct.  If you wanted doubles
passed, you could always do:

	double foo(double, int);

	double
	foo(double x, int n)
	{ ... };



-- 
Mark H. Colburn                       mark at Minnetech.MN.ORG
Open Systems Architects, Inc.



More information about the Comp.lang.c mailing list