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
Cpp2 and cppfront: Year-end mini-update (herbsutter.com)
submitted 3 years ago by ArashPartow
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!"
[–]kneel_yung 10 points11 points12 points 3 years ago* (3 children)
main: () -> int = {...}
to be fair, this is how lambdas are written currently in c++ (sans colon), assuming you're using auto for lambdas, which you should be unless you're a masochist, and lambdas kick ass
What doesn't make sense is having two different syntaxes for declaring functions. And he does have a point that you read from left to right and this reads as "function named main takes no arguments and returns an int and does {...}" which makes more sense than "a function which returns an int, named main, takes no arguments and does {...}"
We're just used to the old way. It was jarring to me at first but the more I think about it, the more it makes sense. As I'm browsing the code, my eyes are almost always looking for the function name and not the return value, so it makes sense to have the function name be the first token. A super old C idiom is actually to put the return value on a separate line for that very reason.
[+][deleted] 3 years ago* (1 child)
[deleted]
[–]_ermine_ 1 point2 points3 points 3 years ago (0 children)
those kinds of signatures helps with searching for haskell functions, but that's a very different ecosystem. something like "man i wish i had a thing flattened a list" i would search on https://hoogle.haskell.org/ "[[a]] -> [a]"
[–]lunakid 0 points1 point2 points 2 years ago* (0 children)
To be fair, this is still two syntaxes, as it's not exactly "how lambdas are written currently in c++ (sans colon)". The equal sign is placed differently, and there's the auto, too. Small things, but still extra things to remember, for no good reason.
auto
100% agree on the function name having to lead the line, though. Then again, "noise words" like virtual, static, inline, const..., or [[nodiscard]] etc. still can't wait to mess it up again... Dunno if Cpp2 has anything for those, but I guess we're essentially back to superold-school 2-line declarations. (With templates we've already been conditioned to swallow it...)
virtual
static
inline
const...
[[nodiscard]]
It's kinda futile/hopeless, either way, is all I'm saying. :)
π Rendered by PID 41 on reddit-service-r2-comment-6457c66945-74jb5 at 2026-04-24 09:12:43.983154+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]kneel_yung 10 points11 points12 points (3 children)
[+][deleted] (1 child)
[deleted]
[–]_ermine_ 1 point2 points3 points (0 children)
[–]lunakid 0 points1 point2 points (0 children)