r/cpp • u/holyblackcat • Mar 09 '26
The compilation procedure for C++20 modules
https://holyblackcat.github.io/blog/2026/03/09/compiling-modules.html
104
Upvotes
r/cpp • u/holyblackcat • Mar 09 '26
View all comments
6
u/ABlockInTheChain Mar 09 '26
This would make sense and be a practical way to implement modules however unfortunately in many case it just isn't possible due to deficiencies in the standard.
Proclaimed ownership declarations (module equivalent of forward declarations) were removed from the proposal prior to standardization so to use a name even as an incomplete type you must import the module which exports it, and import relationships are not allowed to form a cycle.
The standard deficiencies mentioned above mean that in many cases even large projects have no choice but to consist entirely of a single named module which has catastrophic implications for many build scenarios.