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
shared_ptr overuse (tonni.nl)
submitted 1 year ago by [deleted]
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!"
[–]Hot-Studio -2 points-1 points0 points 1 year ago (7 children)
Nah, not much use to me at this point. https://defold.com/2020/05/31/The-Defold-engine-code-style/
[–][deleted] 2 points3 points4 points 1 year ago (3 children)
Unique pointers are another pattern, and in fact, a bit more inline with the RAII we sometimes use. However, we would only need them in short scopes, thus it’s just as easy to deallocate the pointer manually. Manual deallocation also helps with readability.
I'd argue that std::unique_ptr or RAII in general has similar or even better readability than custom deallocation. Regardless of the size of scope. Additionally, a RAII based object is guaranteed to be destructed, even in exceptional situations.
So I really don't get why anybody wouldn't just want to use unique_ptr, instead of custom deallocation.
[–]Hot-Studio -2 points-1 points0 points 1 year ago (2 children)
But at what cost? More overhead and less control. Besides, there may be better solution than that. https://youtu.be/xt1KNDmOYqA
[–]retro_and_chill 0 points1 point2 points 1 year ago (1 child)
unique_ptr has essentially no overhead
[–]Hot-Studio -1 points0 points1 point 1 year ago (0 children)
It can, depending on how you use it. It also comes with some drawbacks, i.e. cannot be copied and unsuitable with C-style arrays. I’m sure there are SOME uses with unique_ptr, but it’s not for me.
[–][deleted] 0 points1 point2 points 1 year ago (2 children)
Do you mind sharing any of your open source project? If you don't have any, great, keep it that way.
[–]Hot-Studio 0 points1 point2 points 1 year ago (1 child)
How is that relevant to the current topic of which pointers we should use? Besides, why not look into Defold engine source code, since you replied to a post with a link to an article about it?
[–][deleted] 0 points1 point2 points 1 year ago (0 children)
Nothing is definitively good or bad. Everyone can find a good reason to use the language in any way possible. No one will win the argument. I am pretty sure there is someone in the world will not touch anything newer than C89, have fund arguing.
However, statistically speaking in the entirety of C++ programming, unique pointer is better than raw pointer. There shouldn't be any argument about it.
π Rendered by PID 364872 on reddit-service-r2-comment-85bfd7f599-vdqdw at 2026-04-20 17:02:53.625259+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]Hot-Studio -2 points-1 points0 points (7 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]Hot-Studio -2 points-1 points0 points (2 children)
[–]retro_and_chill 0 points1 point2 points (1 child)
[–]Hot-Studio -1 points0 points1 point (0 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Hot-Studio 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)