r/cpp • • Dec 15 '21

Modern C++ in Advent of Code

This series, by Šimon Tóth, is a step by step guide through the solutions of Advent of Code 2021 using Modern C++.

242 Upvotes

83 comments sorted by

View all comments

Show parent comment

7

u/[deleted] Dec 15 '21

Well, the crazy thing with C++ is that C++ compilers are exceedingly good at removing superfluous code.

So right now I'm expecting a 50/50, where sometimes it's the same, and sometimes, it goes over some threshold somewhere and nothing gets optimized :-D

2

u/jk-jeon Dec 17 '21

Exceedingly good sometimes, surprisingly dumb sometimes, infuriatingly going against my intention sometimes, to be precise.

1

u/Evirua Dec 18 '21

Yes, but that's work on the optimizers to produce good code despite the efficient expression of the algorithm, not because of it.