Whether one uses #ifndef
s or #pragma once
s, compilers understand guards. And every header file (.h/.hpp) should have a guard. Exceptions perhaps for some .inc files that might be intended to be included more than once.
Is there some compiler option to emit a warning (or even an error) if such a guard is missing? One could certainly grep
for it but I'd prefer a builtin.