Possible Duplicate:
Why does gcc allow arguments to be passed to a function defined to be with no arguments?
the code:
#include <stdio.h>
#include <stdlib.h>
void test_print()
{
printf("test print\n");
}
int main()
{
test_print(1,2);
return 0;
}
although the caller of test_print in main has different amount of arguments with the defination of this function, the code can work very well, but if change it into c++ version, there occurs a compile error "too many arguments to funciton ....". why C allows argument mismatch call of function, when can we use this way of calling? and why it's forbidened in c++.
System ubuntu 11.10
compiler: gcc 4.6.1