Re:Trying out C++20's modules with Clang and Make
by bluGill on Sunday October 15, 2023 @01:34PM
(#37891689)
Unitit builds where you do include everything exists. They have pros and cons.
Re:Trying out C++20's modules with Clang and Make
by Conscat on Sunday October 15, 2023 @02:43PM
(#37892225)
I've never heard of unity builds including everything together. I'm not aware of a build system which even does that by default. If you enable unity in CMake, it groups batches of 5 files together by default, and the documentation discourages users from including everything in a single translation unit.
Re:Trying out C++20's modules with Clang and Make
by knome on Sunday October 15, 2023 @08:08PM
(#37894590)
sqlite calls it an amalgamation build. Whole program building certainly exists. It doesn't explain where the quoted poster got the idea that headers were intended to save space rather than allow for independent compilation.
This claim doesn't make sense to me. You don't want and can't include the implementation in multiple C compilation units because the symbols from them would conflict. I suppose if you include the existence of shared libraries as a means of saving disk space the assertion isn't wholly wrong, but I've never see anyone make such a claim before.
Headers exist even within a C project so that the various parts of it can share the function prototypes and struct definitions while being independently compiled.