Author: paultcochrane Date: Tue May 8 07:34:42 2007 New Revision: 18461 Modified: trunk/docs/pdds/pdd07_codingstd.pod
Log: [docs] Added coding standard text concerning guard preprocessor directives in header files. Patch courtesy of Mike Glines. Modified: trunk/docs/pdds/pdd07_codingstd.pod ============================================================================== --- trunk/docs/pdds/pdd07_codingstd.pod (original) +++ trunk/docs/pdds/pdd07_codingstd.pod Tue May 8 07:34:42 2007 @@ -254,6 +254,26 @@ Variable names must be included for all function parameters in the function declarations. +=item * + +Header files must be wrapped with guard macros, which must have a PARROT_, +followed by some unique and descriptive text identifying the header file, and +be followed with a _GUARD suffix. The matching #endif must have the guard +macro name in a comment, to prevent confusion. For example, a file named +parrot/foo.h might look like: + + #ifndef PARROT_FOO_H_GUARD + # define PARROT_FOO_H_GUARD + + # include "parrot/config.h" + # ifdef PARROT_HAS_FEATURE_FOO + typedef struct foo { + ... + } foo_t; + # endif /* PARROT_HAS_FEATURE_FOO */ + + #endif /* PARROT_FOO_H_GUARD */ + =back