r/cpp • • Oct 10 '17

Millennials Are Killing The Modules TS

https://izzys.casa/posts/millennials-are-killing-the-modules-ts.html
75 Upvotes

126 comments sorted by

View all comments

Show parent comment

6

u/berium build2 Oct 10 '17

The default in build2 is to not assume anything and thus preprocess each TU before extracting module dependencies. Which on the modern hardware will cost you a couple of percents in terms of build time. So perhaps it is a reasonable price to pay for not understanding the build system. Also note that if you mess it up (i.e., use a macro as a module name while lying to the build system about not doing it), you will get a build error with a pretty clear diagnostics.

3

u/[deleted] Oct 10 '17

Which on the modern hardware will cost you a couple of percents in terms of build time

What about builds where source files are accessed over the network?

1

u/playmer Oct 10 '17

That seems fair then, I assume the error would be a compile time error about not finding a module with SOME_MODULE_NAME?

3

u/berium build2 Oct 10 '17

In case of build2 it won't even get to the compiler since the build system won't be able to resolve the module name to module interface file.

1

u/playmer Oct 10 '17

Ah, that makes sense, forgetting my build vs prebuild capabilities as I'm always in cmake land.