Variable and function declarations do look similar; both can have comma separated lists. What is in the list?
One can declare more than one variable in one statement:
int A, B, C;
The statement has essentially one typename and then a comma separated list of identifiers.
However, one cannot do list of lists:
int A, B, float C;
Function declaration has a comma separated list of argument declarations, and identifier is optional within each argument declaration:
1 2
|
void foo( int A, int B, float C ); // ok
void foo( int, int B, float ); // ok
|
Now lets assume that you could declare multiple arguments of same type. The identifier being optional leads to ...
1 2
|
void foo( int A, int B ); // ok
void foo( int , ); // what?
|
and with multiple types:
void foo( int A, B, float C ); // ???
That has two nested comma separated lists: { {int,int} , float }
It is understandable that we don't want to parse such syntax.