I declared a C++ function declaration with 3 arguments, two of which had defaults like so.
void func(int const n, bool const flag=true, int *array=NULL) {
/* print contents of array */
}
When I invoked the function erroneously, omitting the second argument but including the third argument, like so
int array[5]={1,2,3,4,5};
func(5,array);
neither gcc nor intel compilers (default ones on Ubuntu 14.04 LTS) complained that the last argument was specified without specifying the second last one. The code ran but sent in NULL for array (I expected the code to fail).
My question is why didn't the compilers complain that it could not find a matching function since the signature of my invocation should have appeared as
funct(int const, int *)
What options can I turn on during compiling to trigger a warning about this erroneous usage?