From my C++ textbook
an important feature of function prototypes is argument coercion - i.e, forcing argument to the appropriate types specified by the parameter declaration. For example, a program can call a function with an integer argument, even though the function prototype specifies a double argument - the function will still work correctly.
So i've tryied
#include <iostream>
// void foo(double);
void foo(double a) {
std::cout << sizeof(a) << std::endl;
}
int main (void){
int a = 1;
std::cout << sizeof(a) << std::endl;
foo(a);
return 0;
}
and with or without prototype it prints correctly first 4 then (inside function) 8.
Is my compiler that checks function definition in absence of prototypes (that may be not strict C++ standard, but useful too) or I have missed something?