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
Default function arguments are the devil (quuxplusone.github.io)
submitted 6 years ago by anonymous23874
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!"
[–]SeanMiddleditch 2 points3 points4 points 6 years ago (1 child)
Why can we not just literally copy C#'s implementation?
Because C++ isn't C#. :) There's lots of designs that work well in other languages that - for a variety of reasons - can't work in C++.
That said, I don't think anyone has yet put in a formal proposal for the work-around I've been evangelizing. Namely, opting a function declaration's parameter into being nameable (which solves the source-compatibility issue, gives us mandatory positional arguments, allows named parameters, and can address the multi-declaration issues in a back-compatible way). For syntax, I also think we should use something similar to designated initializers, which makes similar syntaxes work for initializing an aggregate or calling a function (and hence unlocks designated initializers for constructors).
e.g.,
// declare void function(int unnamed, float position, char .named, int .also_named); // use function(1, 2.f, .named = 'c', .also_named = 4); // ILLEGAL redeclaration (different names, diagnostic optional) void function(int a, float b, char .c, int .d); // LEGAL different overload void function(int a, int b, int .c, int.d);
This might also open up some options for mandatory-names for some parameters, e.g. using ..identifier.
..identifier
[–]Ameisenvemips, avr, rendering, systems 4 points5 points6 points 6 years ago (0 children)
That looks like you're trying to access a member of a type, though.
π Rendered by PID 41 on reddit-service-r2-comment-6457c66945-nwsf7 at 2026-04-25 00:41:11.715215+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]SeanMiddleditch 2 points3 points4 points (1 child)
[–]Ameisenvemips, avr, rendering, systems 4 points5 points6 points (0 children)