3 ms·
Headers not including other headers is a great thing IMO. If you’re coming into a code base with new eyes there’s less confusion as to where things came from.
by butterisgood 6y ago
Headers not including other headers is a great thing IMO.
If you’re coming into a code base with new eyes there’s less confusion as to where things came from.
Of course if you’re reading code - ctags, and cscope are invaluable. I’ve yet to use this fancy new LSP stuff but it seems popular.
Convenience headers can be ok occasionally but it kind of runs in the face of writing modular software at times.
Syntax highlighting has caught a few mistakes for me in the past but I do think it’s kind of a crutch.
- Cyph0n 6y agoNot including headers in header files can be confusing. Say you maintain a library (lib1.h) that exports an API that takes in an argument defined in lib2.h. If you do not include lib2.h in lib1.h, then the users of your API need to include lib2.h before lib1.h in every source file and header. With a larger number of dependencies, this can become unwieldy for users. In addition, future maintainers of your library may also find it confusing why things break when includes are reordered.