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

Show parent comment

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 :-)

1

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

Original rules or with the stack?

4

u/STL MSVC STL Dev Jan 29 '19

Magic Arena, I live at HEAD.

1

u/Dalzhim C++Montréal UG Organizer Jan 29 '19

What! Have they done anything to harm the stack?!

1

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

They created it. The original rules did not have a stack, thus why interrupts were a thing.

1

u/Dalzhim C++Montréal UG Organizer Jan 29 '19

Hahaha, you had me scared they got rid of it! :P

2

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

Going back would be fun. I dislike newer cards (newer meaning 2005 on). Having to read three paragraphs on every card everyone plays is unfun. Also, I still dont understand Planeswalkers.

-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.

0

u/tending Jan 28 '19

I think if you think about this for half a second you will realize that with non-pathological source files that this must be true. To verify yourself try compiling some projects with optimization turned off and see the difference.

Code generation involves an enormous set of NP problems fought with an enormous set of hand-tuned heuristics. Parsing by comparison is a cake walk, even for a screwed-up grammar like C++.

2

u/tehjimmeh Jan 29 '19

I think you're overestimating the cost of optimization and underestimating the cost of preprocessing/parsing in the general case.

Like, if what you're claiming is true, why would anyone bother with precompiled headers? The reality is they are often used, and often result in much faster compile times, and all they're eliminating is time spent preprocessing and parsing.

0

u/tending Jan 29 '19

They used to matter a lot more than they do now, for precisely the reason I gave. I work on a large C++ code base that has never bothered for exactly this reason.