r/cpp • u/tartaruga232 MSVC user, r/cpp_modules • Apr 02 '26
Current Status of Module Partitions
A brief recap of the current status of module partitions - as I understand it.
- People are using hacks to avoid unneeded recompilations.
- The C++ standard has an arcane concept of partition units, which forces build systems to generate BMI files that aren't used (which is wasting work during builds).
- The MSVC-compiler (per default) provides a simple, easy to use and efficient implementation of module partitions (no unneeded recompilations, no wasted work during builds), but which is not conformant to the current C++ standard.
- A CMake developer is working on a proposal that would fix items 1 and 2, which is probably the smallest required change to the standard, but adds another arcane concept ("anonymous partition units" using the new syntax
"module A:;") on top of an already arcane concept.
Questions:
- How and why did we get into this mess?
- What's the historical context for this?
- What was the motivation for MSVC ignoring the standard per default?1
1 Yes, I know the MSVC compiler has this obscure /InternalPartition option for those who want standard conformant behavior.
34
Upvotes
View all comments
Show parent comment
1
u/pjmlp Apr 03 '26
Actually it is a bit the other way around.
Apple created C modules for consumption by Objective-C, with clang header maps.
Eventually it grew to support C++, and Google makes heavy use of it.
Microsoft decided to create their own vision for modules, and brought it into the standard.
Then there was all the drama, part of which is why header units were added, as they relate to header maps.
So basically this MSVC behaviour might have survived from the original modules implementation initially introduced in VS 2019.
Meanwhile Apple and Google couldn't care less, the build improvements introduced at WWDC two years ago, rely on header maps based modules.
Android still quotes C++17 as the baseline, and the Google C++ style guide forbids modules.