4 ms·
1) Headers cause programmers to take dependencies without realizing. (Especially when unity builds are setup). 2) They are fragile because they involve putting
by DubiousPusher 6y ago
1) Headers cause programmers to take dependencies without realizing. (Especially when unity builds are setup).
2) They are fragile because they involve putting file paths into the code.
3) They cause build information to be in the code rather than with the other build information. To find out what is really being consumed I have to search every code file.
4) They cause all kinds of issues for beginners such as multiply defined errors.
5) They cause the compiler to revisit code hundreds even thousands of times bloating build times. (This is such an extensive problem a small industry has sprang up to address it i.e. precompiled headers, unity builds, fastbuild, etc)
6) They introduce confusing bugs (someone modifies a header in a dependent library but not the dependency, literally had to fix this for a 10 year+ game programmer at a studio you would know. Turns out adding virtual functions in a header will cause an off by 1 vtable lookup and hilarity insues.)
> Package managers are the wrong way to go for C++
I didn't say anything about a package manager. Modules don't require package managers. In .net you can use Nuget or not but the complier understands how to take source and an assembly and hook them up.
I just want a sane way to tell the compiler to build one thing and then use that when it builds the next thing. Rather than this weird concept that every TU has to stand completely on its own.