include guard

The C preprocessor processes inclusion directives like #include "foo.h" to include "foo.h" and transcludes the code of that file into a copy of the main file often called the translation unit.

This non-standard but commonly supported directive among C and C++ compilers has the same purpose as an #include guard, but has less code and does not require the definition of a variable.

The following C code demonstrates a real problem that can arise if #include guards are missing: Here, the file "child.c" has indirectly included two copies of the text in the header file "grandparent.h".

Other common forms of the above example include GRANDPARENT_INCLUDED, CREATORSNAME_YYYYMMDD_HHMMSS (with the appropriate time information substituted), and names generated from a UUID.

Therefore, a project using #include guards must work out a coherent naming scheme for its include guards, and make sure its scheme doesn't conflict with that of any third-party headers it uses, or with the names of any globally visible macros.