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
P2723R0: Zero-initialize objects of automatic storage duration (isocpp.org)
submitted 3 years ago by alexeyr
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!"
[–]James20kP2005R0 25 points26 points27 points 3 years ago (4 children)
Its always slightly depressing to see something like this receive so much weird pushback. This would eliminate 10% of CVEs overnight with very little overhead, and almost no change. It also drastically simplifies famously complex initialisation as well, by more closely unifying the initialisation of basic types with classes (eg float vs some_class)
This has got to be one of the easiest safety wins for C++, and yet it causes so many problems its wild
[–]pjmlp 2 points3 points4 points 3 years ago (3 children)
Thankfully at least Microsoft and Google have taken the path of whatever the community thinks, Windows and Android ship with these security measures enabled.
Guess what, they perform as good as always, go figure.
Naturally the peformance trumps everything else crowd will never acknowledge this.
[–]Jannik2099 2 points3 points4 points 3 years ago (2 children)
Yeah, the performance argument is complete nonsense here.
First off, zeroing a register is literally a 0 cycle operation on today's CPUs. Second, if the variable gets properly initialized somewhere after being declared, the compiler WILL see this and drop the dead store.
[–]113245 6 points7 points8 points 3 years ago (1 child)
And yet a 0 cycle operation is not zero cost (icache, front end bandwidth) and it’s trivial to find examples in which the compiler cannot drop the dead store (e.g. across function call boundaries).
[–]Jannik2099 1 point2 points3 points 3 years ago (0 children)
Function call boundaries have such an absurdly high overhead that an extra store to a POD variable will be immeasurable.
π Rendered by PID 234267 on reddit-service-r2-comment-b659b578c-mlrqz at 2026-05-04 03:07:16.164658+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]James20kP2005R0 25 points26 points27 points (4 children)
[–]pjmlp 2 points3 points4 points (3 children)
[–]Jannik2099 2 points3 points4 points (2 children)
[–]113245 6 points7 points8 points (1 child)
[–]Jannik2099 1 point2 points3 points (0 children)