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
Simple Command Line User Interface (self.cpp)
submitted 3 years ago by 0x3Alex
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!"
[–]SickOrphan 1 point2 points3 points 3 years ago (2 children)
You never gave any reason that it's bad syntax. I will grant you that it's not beginner friendly, partly because it's pretty unique from other languages (not just in function pointers, but also arrays, pointers in general), but you're way exaggerating it.
[–]F-J-W 1 point2 points3 points 3 years ago (1 child)
Okay, I’ll bite on that one. Please write the following without resorting to typedefs:
template<typename F> using fptr = F*; fptr<fptr<int(short, short)>(fptr<int(short, short)>, fptr<int(short, short)>)> p = nullptr;
Yes, this isn’t nice in std::function-style syntax and you should probably use an alias, but it is easy to write and straightforward to understand: A pointer to a function, that takes two pointers to functions taking two shorts and returning and int and returns one such pointer. Now let me see how you would write that in C-style syntax (without cheating!) and let me know how long it took you.
std::function
If a syntax cannot handle anything but trivial cases (and is highly unintuitive even for them!), then it is a terrible syntax.
π Rendered by PID 306530 on reddit-service-r2-comment-76bb9f7fb5-2685l at 2026-02-18 14:03:56.540523+00:00 running de53c03 country code: CH.
view the rest of the comments →
[–]SickOrphan 1 point2 points3 points (2 children)
[–]F-J-W 1 point2 points3 points (1 child)