DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Complying with standard C

Writing new code

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.


Next topic: Updating existing code
Previous topic: Mixing old and new style functions

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005