Versions Compared

Key

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

Functions that takes no parameter should explicitly declare a void parameter as parameter list. This holds true during both the declaration and definition section (and they should match), especially given that many compilers today still allow implicitly declared functions, though C99 has eliminated it.

Wiki Markup
Defining a function with or without void is not the same, because in latter case the compiler will not check whether the function is called with parameters at all \[[C void usage|http://tigcc.ticalc.org/doc/keywords.html#void]\]. Thus, function calling with arbitrary parameters will be accepted without a warning at compile time.

Failure to declare void parameter will results in ambiguous functional interface between caller and callee, and even sensitive information outflow.

...

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]\]