Prototyping char parameters in ANSI C

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Apr 27 14:23:04 AEST 1989


In article <3950014 at eecs.nwu.edu> gore at eecs.nwu.edu (Jacob Gore) writes:
>	void f(char);
>	void f(c)
>	   char c;
>	{
>	}
>The version of GNU cc I have complains:

Once again GCC is correct.  The "old style" function definition is of
a function that is passed an int (NOT a char) argument when it is called
and which subsequently accesses the least-significant char of the int
that was passed.  The prototype declaration is for a function that is
(potentially) passed just a char, not an int.  Therefore the argument-
passing details are potentially different between the two cases, and it
is considered a function declaration/definition mismatch.



More information about the Comp.lang.c mailing list