r/cpp • u/tartaruga232 MSVC user, r/cpp_modules • Apr 15 '26
How a Module Should Look Like
https://abuehl.github.io/2026/04/14/how-a-module-should-look-like.htmlThis illustrates the point using real code examples from the Core module of our UML Editor. The presented source code of our Core module is complete.
All published source code examples in the text or linked from it are 100% standard conformant. However, the code contains redundant imports. On purpose. Read the text for why!
(See also my previous posting "Let's bite the Bullet: Module Units shouldn't implicitly import anything" for context).
33
Upvotes
View all comments
Show parent comment
1
u/tartaruga232 MSVC user, r/cpp_modules Apr 15 '26 edited Apr 15 '26
(referring to
"module Core:; // note the extra colon")Agreed.
See also the original comment, which for the first time made me aware of this idea of an additional new syntax for the standard.
Not really.
I wasn't there when the committee discussed it and decided about it. I believe, in retrospect, it was a bad decision. But it's not a defect in the standard. The standard is consistent and clear about the semantics.
Not that know of. But there is a known messy workaround for reducing unneeded recompilations. We decided against using that workaround, because using it solves one problem, but adds new problems. We decided to live with the unneeded recompilations instead, but leave the redundant imports in the code. All I really wanted to know is, what is the cleanest form of C++ source code using modules with partitions.