aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-06-13 19:09:59 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2017-06-13 19:33:47 +0200
commit22ec7688388694289cf5ffdc39c69ee3b12c8a23 (patch)
tree1dbf5bd5bb9537e7e26c23a19a37b0cb06cd73d1
parenta514ac3dcb6058f7567025e95805a4592323da82 (diff)
parenta090d1c1c9c379bce7345ba5b78aa9491e350d0b (diff)
downloadbitcoin-22ec7688388694289cf5ffdc39c69ee3b12c8a23.tar.xz
Merge #10575: Header include guideline
a090d1c Header include guideline (Pieter Wuille) Tree-SHA512: 44c46a3e249c946303b0fa45ddeba1abc40ec4f993b78f10894d6f43de2b62c493d74f8a24b5b69d3c71cd5c1b3cdb638c8eabdade3dc60e376bc933a8f10940
-rw-r--r--doc/developer-notes.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc/developer-notes.md b/doc/developer-notes.md
index ec6abda91e..a596ea0117 100644
--- a/doc/developer-notes.md
+++ b/doc/developer-notes.md
@@ -425,6 +425,14 @@ Source code organization
- *Rationale*: Shorter and simpler header files are easier to read, and reduce compile time
+- Every `.cpp` and `.h` file should `#include` every header file it directly uses classes, functions or other
+ definitions from, even if those headers are already included indirectly through other headers. One exception
+ is that a `.cpp` file does not need to re-include the includes already included in its corresponding `.h` file.
+
+ - *Rationale*: Excluding headers because they are already indirectly included results in compilation
+ failures when those indirect dependencies change. Furthermore, it obscures what the real code
+ dependencies are.
+
- Don't import anything into the global namespace (`using namespace ...`). Use
fully specified types such as `std::string`.