USDA ARS

Header files

Header files should contain any "#define"s, "typedef"s, or "extern" declarations that would otherwise be duplicated across multiple source files in a program or library.

Header files should be functionally organized; e.g., the header file "geoh.h" contains the declarations, "typedef"s, etc. needed to manipulate geodetic image headers. Header files should not include other header files; this tends to obscure dependencies between different components of IPW, of which the reader of the code ought to be aware. Of course, the comments in a header file should mention any other header files that the header file depends on (except "ipw.h", which all header files are assumed to require).

The first and last lines in a header file should comprise a conditional "wrapper", which prevents the file from being included more than once in the same compilation:

#ifndef H_xxx
#define H_xxx

 ...

/* H_xxx */
#endif
where xxx is the capitalized name of the header file, without the ".h" extension.

#include directives should always be near the top of a source file, immediately following any general top-level comments. "ipw.h" is always the first header file following the #include directives for system header files.


IPW documentation / Last revised 20 May 2009 / IPW web site