There is a real, functional difference between a function with an empty parameter list and one with an explicitly void
parameter list:
It is possible to pass parameters to a function with an empty list; the compiler won’t complain. That is not the case for a function with a
void
list. Thus, it is possible, and even easy to invoke empty-list functions incorrectly without knowing it, and thereby introduce the
kind of subtle bug that can be very difficult to track down.
Noncompliant code example
void myfunc (); // Noncompliant
//...
void otherFunc() {
int a = 4;
//...
myfunc(a); // Compiler allows this
}
Compliant solution
void myfunc ( void );
//...
void otherFunc() {
int a = 4;
//...
myfunc(a); // Compiler error!
}