4 ms·
If you keep your header files independent, you have no reason to include a single header multiple times, and you can't do it accidentally through another header
by ori_b 16y ago
If you keep your header files independent, you have no reason to include a single header multiple times, and you can't do it accidentally through another header.
If your header files don't transitively include other headers, then
#include "a.h"
#include "b.h"
will never cause an error. Therefore, in well written code, the include guards will be no-ops, and for simplicity's sake, they may as well be left off.
- rcfox 16y agoSure, this isn't a problem in trivial projects. If you want to use types other than what the language gives you, you're going to have to introduce a dependency.