Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Wiki Markup
There is a similar rule that deals with parameter type in a more general sense: \[[DCL07-C. Include the appropriate type information in function declarators|DCL07-C. Include the appropriate type information in function declarators]\].

In C++ the usage of foo() and foo(void) has exactly the same meaning and effect, so this rule doesn't apply to C++.
But it is still recommended to explicitly declare foo(void) instead of foo() to distinguish from foo(...), which will then takes arbitrary parameters.

Noncompliant Code Example (ambiguous interface)

...

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

Other Languages

In C++ the usage of foo() and foo(void) has exactly the same meaning and effect, so this rule doesn't apply to C++.
But it is still recommended to explicitly declare foo(void) instead of foo() to distinguish from foo(...), which will then takes arbitrary parameters.

References

Wiki Markup
\[[ISO/IEC 9899:1999|AA. C References#ISO/IEC 9899-1999]\] Forward and Section 6.9.1, "Function definitions"
\[[C void usage|http://tigcc.ticalc.org/doc/keywords.html#void]\]