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

9

u/tending Jan 28 '19

I think this analysis is missing the fact that most of the work can still be parallelized because most of the work in a modern compiler is code generation. I have not read the proposal in detail but from this blog's description it sounds like it should be possible to produce the BMI for foo.cpp in a separate step before generating machine code. I imagine that this is how Java and C# have to work -- dumb fast compilation to byte code is necessary to import, but then the slow AOT or JIT compiling of the byte code is done later. BMI doesn't even require generating a full byte code, just a description of the interfaces. If it can work for Java and C# at scale I don't see why it can't work for C++.

Also with module was the work that can't be parallelized, the initial parsing, should be easier than before.

1

u/Ameisen vemips, avr, rendering, systems Jan 28 '19

Is it even trivial to force GCC/Clang/CL to emit IL that is not yet optimized? They usually emit object files.

1

u/tending Jan 28 '19

-O0, -fsyntax-only

1

u/Ameisen vemips, avr, rendering, systems Jan 28 '19

Does that work in Clang and MSVC/CL?