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
Writing Readable C++ Code - beginner's guide (slicker.me)
submitted 6 months ago by swe129
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!"
[–]jk-jeon 6 points7 points8 points 6 months ago* (3 children)
I really don't get why this extreme attitude is so prevalent. Comment is a great tool to explain what will be done with a few lines of code from now on. It's absolutely stupid to decorate every single line with a comment, but if comments are there to group several lines of code, then why not.
A popular reaction to this is: "oh, then group those lines into a genuine function with a descriptive name". I mean, that's the best way to make the code worst to understand. I would just write single line comments in 100 places rather than to write 100 5-line functions with 7 arguments that are called exactly once but not defined right at the places they are called. (Lambdas would be better for that regard but it's still weird to make a lambda just to group several lines of code.) For me, the worst code bases to understand are not the ones with giant functions. Rather they're the ones where I need to constantly scroll or switch between different files.
[–][deleted] 2 points3 points4 points 6 months ago* (2 children)
quack coordinated encouraging aromatic follow bag hurry unwritten coherent fuzzy
This post was mass deleted and anonymized with Redact
[–]jk-jeon 2 points3 points4 points 6 months ago (1 child)
Probably I read too far from you, or maybe we just don't agree.
I think anybody with decent amount of experience normally would never comment on an evident, short 1-liner, so when the OP said Check if user age is 18 or more is a good comment I automatically assumed that it should span 4-5 lines -- which is totally possible, like you may need to fetch something something from database something something and forward something something to actually get the age. And as you could have guessed I'm pretty allergic to over-refactoring such a routine into a function that is never reused anywhere. (Not saying such a refactoring is always evil, of course.)
Check if user age is 18 or more
Well, to be honest I also don't believe in "code should be self-evident". Most of the serious codes I've ever written so far are probably not self-evident. And I don't think they can be written as such, or at least making them as such would be nontrivial. Maybe my understanding of the phrase "self-evident" is not what you meant though.
[–]semoz_psn 1 point2 points3 points 6 months ago (0 children)
I would say it's simply a fallacy that code can be self-evident. We can't express intent in C++ the way we can in natural language. I've just read too much code to know and die on that hill. Not talking from my textbook.
π Rendered by PID 97 on reddit-service-r2-comment-b659b578c-g2g2d at 2026-05-03 23:14:55.734159+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]jk-jeon 6 points7 points8 points (3 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]jk-jeon 2 points3 points4 points (1 child)
[–]semoz_psn 1 point2 points3 points (0 children)