google一下 c overiding发现有这样一段英文解释:
Because C doesn't require that you pass all parameters to the function if you leave the parameter list blank in the prototype. The compiler should only throw up warnings if the prototype has a non-empty parameter list and you don't pass enough enough arguments to the function.
在c语言里面如果函数原型参数列表为空,编译器不会要求你把所有参数传递给函数。
如果编译器发现函数原型参数列表非空,并且没有传递足够的参数给函数,他应该仅仅只抛出一个警告。
itsme@dreams:~/C$ cat param.c
#include
void func();
int main(void)
{
func();
func(, );
return ;
}
void func(int a, int b)
{
if(a == )
puts("Only going to use first argument.");
else
printf("Using both arguments: a = %d, b = %d\n", a, b);
}
itsme@dreams:~/C$ gcc -Wall -ansi -pedantic param.c -o