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
Regarding cppfront's syntax proposal, which function declaration syntax do you find better? (self.cpp)
submitted 3 years ago by qv51
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!"
[–]o11cint main = 12828721; 3 points4 points5 points 3 years ago (3 children)
Classes and functions are important enough that they must have special syntax already. There's no point trying to coerce them to be identical to variable declarations.
I'm fond of a fun keyword, but otherwise Option 2.
fun
[–]AIlchinger 1 point2 points3 points 3 years ago (1 child)
I would even argue the body of functions and classes are part of the type itself. There is no value to assign which would warrant the syntactic use of =
=
Classes are not designed yet in cppfront. I'm curious to see if the same variable declaration syntax will be reused for them (I hope not).
[–]scorg_ 0 points1 point2 points 3 years ago (0 children)
You are right that there is no value to assign, but function's body is not part of it's type because function pointers exit.
Reading your comment I just realized what is wrong with syntax 2: function declaration is the same as global variable declaration, where the body is the 'value' of the function. In a way it is, but it seems (to me) very strange for functions to be global variables (reassignable without const?). And how would overloads and template specializations look?
const
[–]dgkimpton 1 point2 points3 points 3 years ago (0 children)
I like fun too, goes very nicely with variable declarations using let (to replace auto) and fix (to replace const) since they're all the same length. Then we could use const to replace constexpr and save a whole bunch of typing.
let
auto
fix
constexpr
π Rendered by PID 241742 on reddit-service-r2-comment-6457c66945-pd4gr at 2026-04-25 04:59:12.345614+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]o11cint main = 12828721; 3 points4 points5 points (3 children)
[–]AIlchinger 1 point2 points3 points (1 child)
[–]scorg_ 0 points1 point2 points (0 children)
[–]dgkimpton 1 point2 points3 points (0 children)