|
|
When you write an entirely new program, you should use new-style function declarations (function prototypes) in headers and new-style function declarations and definitions in other C source files. However, if there is a possibility that someone will port the code to a machine with a pre-ANSI C compiler, use the macro __STDC__ (which is defined only for ANSI C compilation systems) in both header and source files.
Because an ANSI C conforming compiler must issue a diagnostic whenever two incompatible declarations for the same object or function are in the same scope, if all functions are declared and defined with prototypes (and the appropriate headers are included by the correct source files), all calls should agree with the definition of the functions -- thus eliminating one of the most common C programming mistakes.