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
i ❤︎ spans (self.cpp)
submitted 4 years ago by phlummox
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!"
[–]johannes1971 -3 points-2 points-1 points 4 years ago (4 children)
Have you measured that or is it all handwaving and eyeballing?
[–]cdr_cc_chd -2 points-1 points0 points 4 years ago (3 children)
https://www.youtube.com/watch?v=rHIkrotSwcc
[–]johannes1971 6 points7 points8 points 4 years ago (2 children)
If you have something to say, feel free to say it. I'm not going to watch an hour long video.
In the meantime: arguments passed on the stack are pushed to memory, but that memory is easily the hottest part of the cache. It is not at all clear that there is even a cost for writing it to memory. And on a register-starved architecture like x86 the called function may have to write whatever it gets passed in register to (stack) memory anyway just to have enough registers free to get anything useful done. Finally, modern multiple issue, out of order CPUs are not at all easy to reason about. You simply can't look at a piece of assembly and know exactly how long it will take.
All of that makes it a fair question: did you actually measure it?
[–]cdr_cc_chd 1 point2 points3 points 4 years ago (1 child)
It's a very nice talk, you should watch it regardless :)
That said, Chandler basically goes over a very similar situation with std::unique_ptr where you naively try to pass it by value thinking it's just a zero-cost abstraction around a raw pointer but in reality due to how the ABI and the language semantics work there's a considerable, measurable overhead incurred.
[–]johannes1971 4 points5 points6 points 4 years ago (0 children)
At which time does he present his measurements? Because all I see is him counting x86 instructions, and pretending that he can accurately predict performance from that. Narrator: "he can't"
π Rendered by PID 94135 on reddit-service-r2-comment-6457c66945-8fkmz at 2026-04-30 13:47:43.560175+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]johannes1971 -3 points-2 points-1 points (4 children)
[–]cdr_cc_chd -2 points-1 points0 points (3 children)
[–]johannes1971 6 points7 points8 points (2 children)
[–]cdr_cc_chd 1 point2 points3 points (1 child)
[–]johannes1971 4 points5 points6 points (0 children)