Similar to issue 22342, functions can be implicitly declared in C11, and will have default function type `int(...)`.
---
int main()
{
func(12);
func("12");
func(1.2);
return 0;
}
Comment #1 by ibuclaw — 2021-09-29T08:05:43Z
(In reply to Iain Buclaw from comment #0)
> Similar to issue 22342, functions can be implicitly declared in C11, and
> will have default function type `int(...)`.
On the C side, the type is really `int()`, but not specifying any parameters is the same as accepting any parameters.
Comment #2 by bugzilla — 2021-10-07T00:26:12Z
Although implicit function declarations used to be Standard, they are not as of C99. They are still allowed by clang and gcc, but:
cc -c test.c -std=c99 -pedantic-errors
will correctly yield:
error: implicit declaration of function `func`
Implicit function declarations are a terrible, bug-prone feature that has been outlawed for over 20 years.
Note that clang at least warns on it.
Some discussion:
https://stackoverflow.com/questions/9182763/implicit-function-declarations-in-c/9182835