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.

25

u/[deleted] Jan 28 '19

most of the work in a modern compiler is code generation

[citation-needed] :)

5

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

Most of the work CL does is sending the code to /u/BillyONeal and /u/STL, and waiting for them to compile it manually. Their response times and determinism are impressive. Not sure what, exactly, internal compiler errors indicate, though - did my code hospitalize them?

Not sure how Clang emulates this.

Citation: me. :)

6

u/STL MSVC STL Dev Jan 29 '19

Sometimes Billy is playing poker while I'm playing Magic. That's where fatal error C1001s come from :-)

-2

u/TheTerroristAlWaleed Jan 29 '19

Speaking of Bills, why does Billy Gates co-own the top floors of the mandalay bay hotel with the Islamic terrorist Al Waleed Bin Talal? The Las Vegas massacre was pretty fatal.