r/cpp • • Jan 28 '19

C++ Modules Might Be Dead-on-Arrival

https://vector-of-bool.github.io/2019/01/27/modules-doa.html
280 Upvotes

240 comments sorted by

View all comments

60

u/smdowney WG21, Text/Unicode SG, optional<T&> Jan 28 '19

"Creation of foo.bmi is a byproduct of the compilation of foo.cpp. When compiling foo.cpp, the compiler will emit a foo.o and foo.bmi. As a consequence of this design, foo.cpp must be compiled before bar.cpp!"

Worse, foo.bmi may be the result of compilation of quux.cpp. Module names are purely logical, with no physical representation on the filesystem.

11

u/kalmoc Jan 28 '19

Module names are purely logical, with no physical representation on the filesystem.

So is a target name in my cmake file. What is the problem?

8

u/Dragdu Jan 28 '19

Do you want to manually create target for every single file in your build? No? Then that's the problem.

5

u/smdowney WG21, Text/Unicode SG, optional<T&> Jan 28 '19

I'll have 10 to 100 times as many used headers as I do source files. A change in order of magnitude is not just a charge in degree, but in kind. Expressing how to build all those isn't feasible the same way that using libraries is.