-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
You should only include the headerfiles needed for the file to compile.
I you only need to forward declare a type, you should do that. Eg. if you only use a pointer to the type.
A source file should include its corresponding header file as the first file in the include list. This will ensure that the header file can be compiled on its own.
It is more a rule than the exception that these principles are violated. This makes it harder to reason about the dependencies among the files and it increases compilation time.
This should be an easy task to do as many tools can be used to detect not needed inclusions.