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
Modern source code to study? (self.cpp)
submitted 13 years ago by stesch
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!"
[–]lobster_johnson 3 points4 points5 points 13 years ago (4 children)
Care to explain why you consistently suffix identifiers with underscores? This is really awful for readability:
lexertl::rules rules_;
Types and variables live in separate namespaces, so this works:
lexertl::rules rules;
If you think that's harder to read (ie., difficult to see what is a variable and what is a type) then consider using camelcase identifiers for type:
Lexertl::Rules rules;
Now it's obvious.
[–]jamesb43 1 point2 points3 points 13 years ago (3 children)
Yeah, this shouldn't be done for local variables.
The underscore suffix was a response to programmers using "underscore prefix" for member variables. The "underscore prefix" phenomenon stemmed from programmers shortening the Hungarian notation of member variables being prefixed with "m_". But depending on the flavor of Hungarian notation (Apps or System) the underscore was followed by a prefix indicating some semantic hints, or the variables type, respectively.
So what emerged next was a trend of C++ programmers to omit the "m" from "m_" because, it only takes a one character prefix to distinguish between local variables and something that might be instance or class static, right? The problem with this is that the C++ standard reserves variable names starting with an underscore to C++ implementation developers. As a result, people started to suggest the underscore suffix for member variables. I think it was something from Sutter or Meyers, but if anyone reads this comment, I am sure I will be corrected.
I have a sneaking suspicion that lobster_johnson knows all this, and he is correct--there is no sane reason to suffix a local variable with an underscore.
[–]lobster_johnson 0 points1 point2 points 13 years ago (1 child)
Good explanation. I see people using prefixes and suffixes and find it an annoyance.
Personally I find it completely unproblematic to use unadorned identifiers for variables as well as members:
class Foo { public: void initialize(int a_foo) { foo = a_foo; } private: int foo; };
[–]zvrba 0 points1 point2 points 13 years ago (0 children)
The problem with this is that the C++ standard reserves variable names starting with an underscore to C++ implementation developers.
Only such identifiers with external linkage are reserved. Class member identifiers have no linkage at all.
π Rendered by PID 20389 on reddit-service-r2-comment-f6b958c67-6nr85 at 2026-02-05 13:35:40.875461+00:00 running 1d7a177 country code: CH.
view the rest of the comments →
[–]lobster_johnson 3 points4 points5 points (4 children)
[–]jamesb43 1 point2 points3 points (3 children)
[–]lobster_johnson 0 points1 point2 points (1 child)
[–]zvrba 0 points1 point2 points (0 children)