|Non-Confidential||PDF version||ARM DUI0472M|
|Home > Compiler Coding Practices > Guarding against multiple inclusion of header files|
Guarding against multiple inclusion of header files has a number of benefits.
Specifically, guarding against multiple inclusion of header files:
Improves compilation time.
Reduces the size of object files generated using the
command-line option, which can speed up link time.
Avoids compilation errors that arise from including the same code multiple times.
/* foo.h */ #ifndef FOO_H #define FOO_H 1 ... #endif /* bar.c */ #ifndef FOO_H #include "foo.h" #endif