Master Include Files - Good or Bad Practice
c, c++
Solution
Most of the answers are mentioning compile time, and ignoring the fact that precompilation of headers has huge compile time benefits, and works much better with the master header technique.
Preferably, your headers should work if directly included without a master header file (this makes testing easier). Modern compilers have optimized the "skip header file if multiply included" logic.
Problem
I have seen quite a few projects (often game engines) where all the header includes are placed in a single header file which sometimes contains macros etc as well e.g. ``` // Master.h #include "header1.h" #include "header2.h" #include "header3.h" . . #include "headerN.h" ``` Then when using code, the standard would be to only include Master.h file. Other projects work on the basis that the source files should include only the headers they need. What I want to know is if there is a definitive answer as to best practice, preferably with measurable results, or is it personal preference?