What is a parameter forward declaration?
This form of function definition:
void fun(int i; int i)
{
}
uses a GNU C extension called the parameter forward declaration feature.
http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html
This feature allows you to have parameter forward declarations before the actual list of parameters. This can be used for example for functions with variable length array parameters to declare a size parameter after the variable length array parameter.
For example:
// valid, len parameter is used after its declaration
void foo(int len, char data[len][len]) {}
// not valid, len parameter is used before its declaration
void foo(char data[len][len], int len) {}
// valid in GNU C, there is a forward declaration of len parameter
// Note: foo is also function with two parameters
void foo(int len; char data[len][len], int len) {}
In the OP example,
void fun(int i; int i) {}
the forward parameter declaration does not serve any purpose as it is not used in any of the actual parameters and the fun
function definition is actually equivalent to:
void fun(int i) {}
Note this is a GNU C extension and it is not C. Compiling with gcc
and -std=c99 -pedantic
would give the expected diagnostic:
warning: ISO C forbids forward parameter declarations [-pedantic]