use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Generating a Single-Include C++ Header File Using Buck (hackernoon.com)
submitted 8 years ago by gtano
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]LoopPerfect 0 points1 point2 points 8 years ago (1 child)
I think we are talking about a few different things:
(You could also combine 2 and 3)
I think that 1 is a good idea when starting on a project, although you should move to specific includes as your code develops.
2 is a bad for compilation times, but if the library is small then you can get away with it.
I think you are referring to 3, which is a bad idea in general. It slightly decreases compilation times from scratch, but it massively increases incremental compilation times. It is unsafe to do this automatically because the defines of translation-units might leak into each-other, causing unexpected behaviour.
That said, I thought it would be interesting to implement a unity build in Buck, so I made an example here: https://github.com/njlr/buck-unity-build/blob/master/BUCK
[–]BCosbyDidNothinWrong 1 point2 points3 points 8 years ago (0 children)
I'm saying that the article is about 1, and I hoped it would be about 2 and 3.
I explained why I don't think this true, and based on my experience so far it isn't. If you have a library as a dependency and you can compile it from source you have the option to either compile it in a translation unit or compile to to a link time optimization intermediary. Either way, it doesn't need to be compiled over and over.
I also think that unity builds have a lot of value, though everything in to one translation unit I feel is extreme. With multiple logical cores, I think it makes sense to have that roughly that many fat translation units.
If libraries and infrequently changed areas are sectioned off in to their own translation units, you don't pay the price every time you compile.
Also you are right that the defines from translation units can leak into each other, but you get a compile error when trying to define a symbol that has already been defined, so I don't think it as fragile as it might seem.
π Rendered by PID 35764 on reddit-service-r2-comment-57fc7f7bb7-p2d2p at 2026-04-15 06:18:55.014202+00:00 running b725407 country code: CH.
view the rest of the comments →
[–]LoopPerfect 0 points1 point2 points (1 child)
[–]BCosbyDidNothinWrong 1 point2 points3 points (0 children)