Skip to content

Commit a090d1c

Browse files
committed
Header include guideline
1 parent 2c2d988 commit a090d1c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/developer-notes.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,14 @@ Source code organization
425425
426426
- *Rationale*: Shorter and simpler header files are easier to read, and reduce compile time
427427
428+
- Every `.cpp` and `.h` file should `#include` every header file it directly uses classes, functions or other
429+
definitions from, even if those headers are already included indirectly through other headers. One exception
430+
is that a `.cpp` file does not need to re-include the includes already included in its corresponding `.h` file.
431+
432+
- *Rationale*: Excluding headers because they are already indirectly included results in compilation
433+
failures when those indirect dependencies change. Furthermore, it obscures what the real code
434+
dependencies are.
435+
428436
- Don't import anything into the global namespace (`using namespace ...`). Use
429437
fully specified types such as `std::string`.
430438

0 commit comments

Comments
 (0)