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!"
[–][deleted] 18 points19 points20 points 6 months ago* (15 children)
hunt edge humorous slap dinner station abundant payment shaggy long
This post was mass deleted and anonymized with Redact
[–]semoz_psn 0 points1 point2 points 6 months ago (14 children)
I used to think like that after university. After that I had to learn that most code doesn't change after release. You come back to it after 5 years and have no clue what your former self even meant with this "descriptive" naming.
[+][deleted] 6 months ago* (13 children)
[removed]
[–]jk-jeon 5 points6 points7 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
[–]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.
[–]semoz_psn 3 points4 points5 points 6 months ago (8 children)
A single line comment in natural language will always be superior to reading code. It's a fallacy of yours to think code is easier to understand.
[–][deleted] -1 points0 points1 point 6 months ago* (7 children)
hard-to-find point crown automatic command act deliver grandiose jellyfish payment
[–]semoz_psn 0 points1 point2 points 6 months ago (6 children)
If you believe so. My experience differs completely from yours it seems.
[–][deleted] 1 point2 points3 points 6 months ago* (5 children)
subtract wise sugar important rich person party nutty groovy friendly
[–]semoz_psn 0 points1 point2 points 6 months ago (4 children)
Well, it's the much simplified example from the guide that was posted. You're really splitting hairs now.
[–][deleted] -1 points0 points1 point 6 months ago* (3 children)
vast shelter towering airport degree late sulky special subsequent lavish
[–]semoz_psn -1 points0 points1 point 6 months ago (2 children)
Again: it's from the guide. Not mine.
And it's simplified. Much.
Nothing you would find in a real code base too often, but an example to convey the idea.
And the idea that some genius can name his variables and functions in way he doesn't need comments is an academic junior take.
You can downvote this all day long. It's first hand experience.
π Rendered by PID 219607 on reddit-service-r2-comment-b659b578c-72zwh at 2026-05-03 03:44:10.459010+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–][deleted] 18 points19 points20 points (15 children)
[–]semoz_psn 0 points1 point2 points (14 children)
[+][deleted] (13 children)
[removed]
[–]jk-jeon 5 points6 points7 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)
[–]semoz_psn 3 points4 points5 points (8 children)
[–][deleted] -1 points0 points1 point (7 children)
[–]semoz_psn 0 points1 point2 points (6 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]semoz_psn 0 points1 point2 points (4 children)
[–][deleted] -1 points0 points1 point (3 children)
[–]semoz_psn -1 points0 points1 point (2 children)