Compiling with gcc8:
#include <stdio.h>
void some_func(void f1(void), void (*f2)(void))
{
printf("%d\n", f1);
printf("%d\n", f2);
}
Gives (only) the following warnings:
<source>:11:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
printf("%d\n", f1);
<source>:12:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'void (*)(void)' [-Wformat=]
printf("%d\n", f2);
Why is the type of f1
the same as f2
? Only f2
is declared as a function pointer. I would expect f1
not to compile at all, as it names a function type, not a function pointer. What is the rule that says, that a function type inside a function parameter list changes to a pointer to that function type?