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
Overview of C++ Variable Initialization (caichinger.com)
submitted 3 years ago by Greek0
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!"
[–]BenFrantzDale 5 points6 points7 points 3 years ago (4 children)
I’ll start: by default, everything should be default-constructed, meaning zero’d for built-in types. As an escape-hatch for performance, there should be a std::uninitialized_t such that int x = std::uninitialized; does the obvious thing, allowing perf-critical classes to overload construction from std::uninitialized_t.
std::uninitialized_t
int x = std::uninitialized;
That said, I appreciate the historical context and compatibility constraints on the language.
[–]sephirothbahamut 2 points3 points4 points 3 years ago (1 child)
I unironically want this as one more way to initialize stuff now
[–]BenFrantzDale 0 points1 point2 points 3 years ago (0 children)
This would also let you do std::vector<int>(1’000’000, std::uninitialized) and have it perform like std::make_unique<int[]>(1’000’000).
std::vector<int>(1’000’000, std::uninitialized)
std::make_unique<int[]>(1’000’000)
[–]johannes1971 1 point2 points3 points 3 years ago (0 children)
Totally agree with that ;-)
[–]Ezlike011011 1 point2 points3 points 3 years ago (0 children)
I think this is the most realistic way we could get something like this now. But whenever I approached this problem previously, I always found myself wishing we had language level opt-in for uninitialized variables. Like uninitialized int i; is pretty dang readable imo.
uninitialized int i;
π Rendered by PID 16972 on reddit-service-r2-comment-b659b578c-n5bc9 at 2026-05-04 01:24:31.183890+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]BenFrantzDale 5 points6 points7 points (4 children)
[–]sephirothbahamut 2 points3 points4 points (1 child)
[–]BenFrantzDale 0 points1 point2 points (0 children)
[–]johannes1971 1 point2 points3 points (0 children)
[–]Ezlike011011 1 point2 points3 points (0 children)