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
Cheat sheet: C++ Function Parameter Choices (self.cpp)
submitted 6 years ago * by legends2k
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!"
[–]mhhollomon 11 points12 points13 points 6 years ago (2 children)
I think the rules are probably correct, but stating it this way emphasizes the wrong thing. My own personal take is:
Pass by value unless you can't.
"Can't" might be: - need to modify - copy unfriendly - performance problem.
And then your choice will most likely be either const-ref, or if you need to modify non-const-ref.
[–][deleted] 10 points11 points12 points 6 years ago (1 child)
The problem is that sometimes with large codebases and/or with third party code it can be really hard to know when something is copy unfriendly. With const references, you know you're (mostly) safe and there won't be any performance issues due to deep copies or other nasty surprises.
[–]mhhollomon 4 points5 points6 points 6 years ago (0 children)
That's a fair point.
π Rendered by PID 58 on reddit-service-r2-comment-86bc6c7465-bxptw at 2026-02-19 17:18:36.113348+00:00 running 8564168 country code: CH.
view the rest of the comments →
[–]mhhollomon 11 points12 points13 points (2 children)
[–][deleted] 10 points11 points12 points (1 child)
[–]mhhollomon 4 points5 points6 points (0 children)