r/cpp • • Mar 09 '26

The compilation procedure for C++20 modules

https://holyblackcat.github.io/blog/2026/03/09/compiling-modules.html
101 Upvotes

47 comments sorted by

View all comments

Show parent comment

1

u/mwasplund soup Mar 10 '26

Do you have a concrete example of this scenario in practice? I have heard this argument a few times and it sounds more like a code smell for a design issue instead of a limitation we need to fix in the language. In the rare case that we have a circular dependency that is required then these two classes are already tightly linked conceptually. It seems reasonable to link them physically in a single translation unit. I agree this is not ideal (I prefer one file, one class), but it is not language breaking.

0

u/ABlockInTheChain Mar 11 '26 edited Mar 11 '26

No, I'm just not going to use modules.

And from what I can tell this is going to be a common approach.

For my company modules provide zero benefits. All of the problems they solve are not problems we experience.

If there is any cost whatsoever to using them then we simply won't.

I have heard this argument a few times and it sounds more like a code smell for a design issue instead of a limitation we need to fix in the language.

The language was fine before modules broke it.

If this breakage isn't fixed them modules just won't be adopted.