3 ms·
It basically consists of: 1) The basic, ubiquitous, and uncontroversial rule that headers should be self-contained, i.e. guarded and include their direct depen
by mike_hock 3y ago
It basically consists of:
1) The basic, ubiquitous, and uncontroversial rule that headers should be self-contained, i.e. guarded and include their direct dependencies, and
2) nonsensical rules resulting from failure to follow the first rule, or failure to follow the other basic, ubiquitous and uncontroversial rule that source files should also include their direct dependencies.
Manual forward declarations are a non-starter. Any header that contains a class declaration that it might ever make sense to refer to as an incomplete type (so, like, 100% of all classes, rounded to 3 decimal places) should have a corresponding iosfwd-style forward header.
The common header is just another header. You include it if you need it and you don't if you don't.
- SAI_Peregrinus 3y agoExactly. If the order of your includes matters, you screwed up. Run "Include What You Use", fix the errors.