According to C11the C Standard, Section section 6.7.6.3, para. paragraph 14 [ISO/IEC 9899:2011],
An identifier list declares only the identifiers of the parameters of the function. An empty list in a function declarator that is part of a definition of that function specifies that the function has no parameters. The empty list in a function declarator that is not part of a definition of that function specifies that no information about the number or types of the parameters is supplied.
...
When the compliant solution is used and foo(3)
is called, the GCC compiler will issue issues the following diagnostic, which alerts the programmer about the misuse of the function interface.
...
In C++, foo()
and foo(void)
have exactly the same meaning and effect, so this rule doesn't apply to C++. However, foo(void)
should be declared explicitly instead of foo()
to distinguish it from foo(...)
, which accepts an arbitrary number and type of arguments.
ISO/IEC 9899:2011 Forward Foreword and Section section 6.9.1, "Function definitions"
...