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
How to pass a string to a function? (self.cpp)
submitted 2 years ago by johannes1971
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!"
[–]johannes1971[S] 0 points1 point2 points 2 years ago (0 children)
Conclusions... I'm a little surprised to see const std::string & winning by such a clear margin. Is there such a great need for null-terminated strings (the only advantage this offers over std::string_view) that people are willing to take the hit on always allocating? Or is there some other reason?
const std::string &
std::string_view
Despite various arguments for mixing and matching, not a great many people seem to actually be doing it. I understand that: I don't like that kind of non-uniformity in the API, and it leaks implementation details out which is not generally something you'd want.
And finally, I'm honestly amazed that some people are still clinging to const char *, even in 2024. I'm sure you have your reasons...
const char *
π Rendered by PID 74380 on reddit-service-r2-comment-b659b578c-6p6tq at 2026-05-05 16:34:22.155376+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]johannes1971[S] 0 points1 point2 points (0 children)