#ifndef
construct. This saves you and your clients from having to figure out whether you have already included them.
// MyClass.h #ifndef Taligent_MYCLASS #define Taligent_MYCLASS #ifndef Taligent_PREREQUISITE1 #include "prerequisite1.h" #endif #ifndef Taligent_PREREQUISITE2 #include "prerequisite2.h" #endif ... definitions for MyClass #endif
To speed up compilation, use the following construct in your files that include other files. (Don't use this for ANSI C or C++ header files because the symbols vary between compilers.):
This skips the overhead of reading and parsing #ifndef MyCompany_FOO
#include "Foo.h"
#endif
Foo.h
. This practice works especially well with symbol table load/dump; because the dump file defines the symbols, the include files need not be opened at all.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.