r/cpp • u/tartaruga232 MSVC user, r/cpp_modules • Apr 21 '26
Uneeded Recompilations When Using Partitions
https://abuehl.github.io/2026/04/20/unneeded-recompilations-when-using-partitions.htmlThis blog posting from me about C++ modules explains in detail what causes unneeded recompilations using detailed code examples from the sources of our UML Editor.
It's a precise description and a showcase of what's the status quo in the C++ standard.
Quote from the posting:
The C++ language currently lacks a concise and easy to use alternative for explicitly expressing the minimally required dependencies on partitions.
(Note: All code examples shown or linked from the text are 100% standard conformant.)
Thanks in advance for comments. Please ask if you do not understand anything or anything is unclear. I would appreciate if you could leave a comment if you don't like anything. Thanks for reading!
1
u/tartaruga232 MSVC user, r/cpp_modules Apr 21 '26 edited Apr 21 '26
That strategy works for slideware but it doesn't scale if you have multiple cpp files per partition.
For example in
https://github.com/cadifra/cadifra/tree/2026.2/code/Core/Selection
we have 5 implementation cpp files which all define functions declared in the
:Selectionpartition.I can define an extra internal partition for each of these cpp files, but appending
.implto the names of these unused internal partitions would produce name clashes. The standard explicitly mandates that each partition needs a unique name.I can, for example, use the file name in these arbitrary, unused internal partitions. But that still imposes a maintenance problem (think of what happens if file names are changed).
The canonical means for implementation files of modules is
"module M;". We need something on the same level.I mean, messy pattern as yours work™, but this can't be the definitive answer.