declaration query

Anthony Scian afscian at violet.waterloo.edu
Tue Jun 20 02:59:44 AEST 1989


This question arose from comp.lang.c:

Is this legal (ANSI)?
int foo( int, int y ) { ... }			(1)

I think this should be legal:
int foo( int, int y );

and combined with this:
int foo( int x, int ) {return(x+y);}

COULD be equivalent to:
int foo( int x, int y ) {return(x+y);}

The grammar allows this but it is not clear to me what (1) means
in isolation.
Can identifiers in prototypes be different than the identifiers 
in the function definition? 
What about?
int test( int, int z );
int test( int x, int y ) {return(x+y);}

Should the compiler keep the identifiers and override them when
the function is defined (declared)?

//// Anthony Scian afscian at violet.uwaterloo.ca afscian at violet.waterloo.edu ////
"I can't believe the news today, I can't close my eyes and make it go away" -U2



More information about the Comp.std.c mailing list