I don’t know what Lakos96 says, but I’ll guess anyway ...
The standard includes protection:
foo.h
#ifndef FOO_H_INCLUDED #define FOO_H_INCLUDED .... #endif
In abundance, protection is enabled using a macro when a file is included:
bar.c
#ifndef FOO_H_INCLUDED #include "foo.h" #endif
Thus, the second time the foo.h file is included, the compiler does not even look for it on disk. Therefore, acceleration: imagine a large project, one single compilation unit can include foo.h 100 times, but only the first will be processed. The remaining 99 times will search, open, mark, drop the preliminary compiler and close.
But note that this was in 1996. Today, GCC, to give a well-known example, has certain optimizations that recognize the inclusion protection pattern and makes redundant inclusion protection, well ... redundant.
source share