Re:Function overloading in C
by kazinator on Tuesday July 28, 2015 @03:05PM
(#9963800)
Any decent C compiler has a warning for the situation that an external function is called without a prototype declaration having been seen.
GCC also has diagnostics for when a function definition occurs without a declaration.
From GCC man page:
-Wmissing-prototypes (C and Objective-C only)
Warn if a global function is defined without a previous prototype
declaration. This warning is issued even if the definition itself
provides a prototype. The aim is to detect global functions that
fail to be declared in header files.
-Wstrict-prototypes (C and Objective-C only)
Warn if a function is declared or defined without specifying the
argument types. (An old-style function definition is permitted
without a warning if preceded by a declaration which specifies the
argument types.)
-Wimplicit-function-declaration (C and Objective-C only)
Give a warning whenever a function is used before being declared.
In C99 mode (-std=c99 or -std=gnu99), this warning is enabled by
default and it is made into an error by -pedantic-errors. This
warning is also enabled by -Wall.
GCC also has diagnostics for when a function definition occurs without a declaration.
From GCC man page: