parameter names in prototypes

David Barnett auvbarn at auvc5.tamu.edu
Thu Dec 13 11:53:42 AEST 1990


Is the following prototype legal in ANSI C?

int foo(int a, int );

Saber-C 3.0 rejects this as an error: "The function parameter list has
an illegal format".  On the other hand, gcc 1.37 compiles it without
so much as a warning, even when using -Wall -ansi -pedantic.

I don't see anything in K&R2 that explicitly allows or prohibits this.
Page 26 says "parameter names are optional in a function prototype",
but in each of the examples, either all of the parameters have names
or none do.  What about the half-and-half case above?

(I'm asking because prototypes of this form occur in a vendor-supplied
.h file, and I need to know whether to complain to that vendor or to
Saber-C.)

--
David Barnett
dbarnett at cs.tamu.edu
--
David Barnett
auvbarn at auvsun1.tamu.edu



More information about the Comp.lang.c mailing list