r/cpp • • Dec 28 '18

"Modern" C++ Lamentations

http://aras-p.info/blog/2018/12/28/Modern-C-Lamentations/
307 Upvotes

162 comments sorted by

View all comments

-1

u/rLinks234 Dec 29 '18

I'm not trying to troll or just be the contrarian here, but why are compile times such a massive deal? Sure, I don't like the waste of electrons from having a simple example take 1 second to compile, but is that really such a huge deal? I would rather there be an up front "static" cost to a faster program, than having a less optimal program which is harder to maintain. What kind of compile times are you all talking about here that irk you? The largest projects I've built from source (binutils + gcc + glibc + libstdc++) take about 15 minutes, and it seems like, at the least, a minority majority of that time is spent between linking and miscellaneous build scripts/make commands.

By "harder to maintain," I mean that you use the old "C"-style approach to a problem like pythagorean triples in nested for loops.

I agree that the syntax required is a bit overwhelming and verbose, but I also thought that way when seeing things like std::visit, std::variant and code which uses integer parameter packs (e.g., using std::make_integer_sequence). I was so adamant about C++ "going in the wrong direction" when I first saw these things; however, I don't find them to be overwhelming when used properly.

Also as a pedantic aside, I honestly think reading code that doesn't cuddle braces is much harder to mentally parse. I guess that could be just a consequence of me starting with Java as my first programming language.

2

u/Fazer2 Dec 29 '18

The largest projects I've built from source (binutils + gcc + glibc + libstdc++) take about 15 minutes

Then those were small projects. The big ones go easily into the hours territory on distributed farms.

1

u/rLinks234 Dec 29 '18

ld on a release build takes up ~24GiB of RAM when linking the executable. It's not small.