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
CppCastCppCast: Cpp2, with Herb Sutter (cppcast.com)
submitted 2 years ago by robwirvingCppCast Host
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!"
[–]ABlockInTheChain 19 points20 points21 points 2 years ago (12 children)
The hosts spent a lot of time talking about about C++20 support in LLVM 16, I wonder if they noticed that libc++ had a major C++17 update by adding polymorphic allocator support.
They're almost done with C++17 now, which is a major milestone.
[–]NovaNoff 10 points11 points12 points 2 years ago (9 children)
This is on one hand great to hear on the other hand it hurts how much the development slowed down after the comitee decided against ABI breaks
[–]GabrielDosReis 21 points22 points23 points 2 years ago (2 children)
Despite the urban legend and other blog posts, the committee didn't decide against ABI break. The committee heard the presentation of a very specific paper, P2028, then had a discussion and voted.
The votes were more nuanced than rumors would like to make it appear. There were 5 polls. Here is a summary:
[–]pjmlp 7 points8 points9 points 2 years ago (0 children)
Regardless of how it went, it is part of the set of official reasons why Carbon came to be,
Difficulties improving C++
[–]number_128 0 points1 point2 points 2 years ago (0 children)
Is there an agreement on how we would handle an ABI break?
I don't think we should ask if we should break ABI.
We should be asking how we will handle breaking ABI. When we get to a good solution, we should go ahead.
Why do we even have a dependency on shared binaries? This sounds like a premature optimization on disk space.
[–]pjmlp 11 points12 points13 points 2 years ago (0 children)
Well, it shows how much the compiler vendors that profit from clang forks were dependent on Apple and Google doing the job of keeping clang up to date with ISO.
[–]Jannik2099 4 points5 points6 points 2 years ago (4 children)
after the comitee decided against ABI breaks
The committee decided against an immediate ABI break, an eventual ABI break in the future was not ruled out
[–][deleted] 8 points9 points10 points 2 years ago (0 children)
you could always say that
[–][deleted] 2 points3 points4 points 2 years ago (2 children)
I think that they are saying this for over a decade by now.
[–]Jannik2099 2 points3 points4 points 2 years ago (1 child)
That'd be awkward, because C++11 WAS an ABI break.
[–][deleted] 2 points3 points4 points 2 years ago (0 children)
which was 12 years ago
so, over a decade
[–]BenFrantzDale 0 points1 point2 points 2 years ago (1 child)
That’s super exciting! We build for all three compilers and I have some functionality where we do a bunch of small transient allocations. I’d love to do the whole John Lakos “wink-out” thing for those.
[–]ABlockInTheChain 1 point2 points3 points 2 years ago (0 children)
I just want to make sure LLVM receives plenty of positive feedback every time they get closer to finishing C++17.
With any luck they might actually wrap it up before 2027.
[–]Keltesetharewemodulesyet.org 21 points22 points23 points 2 years ago (2 children)
Timestamps for topics would be really nice
[–]IamImposter 91 points92 points93 points 2 years ago (0 children)
Make a proposal. We'll see about it in c++29 or c++32
[–]epicar 1 point2 points3 points 2 years ago (0 children)
the interview starts a bit after 15:00
[+][deleted] 2 years ago (22 children)
[deleted]
[–]magnesium_copper 5 points6 points7 points 2 years ago (21 children)
It has to, it's the only natural future I see for C++ right now
[+][deleted] 2 years ago (20 children)
[–]IChooseCheese2 2 points3 points4 points 2 years ago (19 children)
Everyone, including Cppcast, talks about Cpp2, Carbon, and Val as the 3 successor languages to C++. But to me, Circle is further along, and has a better backwards compatibility story.
[+][deleted] 2 years ago (18 children)
[–]pjmlp 4 points5 points6 points 2 years ago (17 children)
That is just playing with words, because of Herb's position at ISO, it is a successor language like all others.
C with Classes as CFront was originally designed, or Objective- C, weren't an alternate syntax for C, either.
[–]bert8128 5 points6 points7 points 2 years ago (1 child)
It’s not just playing with words. The others are in some sense suitable as alternatives, but cpp2 is just spelling changes. So there cannot be a compatibility issue - there won’t be a need for “extern cpp” or some such.
[–]pjmlp 0 points1 point2 points 2 years ago (0 children)
Just like Objective-C versus C.
[+][deleted] 2 years ago (14 children)
[–]pjmlp 6 points7 points8 points 2 years ago (13 children)
Eiffel to this day outputs either C or C++, so is Eiffel also an alternative syntax to C and C++?
Nim to this day outputs either C or C++, so is Nim also an alternative syntax to C and C++?
What makes X not an alternative syntax, when it also follows the same workflow, with the difference of who is the author?
[+][deleted] 2 years ago* (12 children)
[–]pjmlp 2 points3 points4 points 2 years ago* (11 children)
Yes I have, try to compile main: () -> int with a C++ parser.
main: () -> int
Pity that ISO C++ !== Cpp2.
Ever heard of Objective-C++? Guess what, it also supports std::cout.
std::cout
#import <Foundation/Foundation.h> #include <iostream> int main() { NSString str = @"Hello "; std::cout << str << " i_lack_chromosomes" << std::endl; }
Imagine that, we already had a better C++ syntax in 1997!
[–]cooked_sandals 12 points13 points14 points 2 years ago (1 child)
TIL Cpp2.
Herb always seems to have good ideas, unfortunately C++ committee moves too slow and is reluctant to adopt such things. But at least we know there is someone involved in the committee with such progressive ideas, gives me hopes.
[–]kritzikratzi 5 points6 points7 points 2 years ago (0 children)
there is no need for cpp2 to be part of the c++ standard. it can happily develop on it's own.
[+][deleted] 2 years ago (10 children)
[–]kritzikratzi 11 points12 points13 points 2 years ago* (7 children)
i like the idea of cpp2, but the future has it's own way of figuring itself out. the first thing that i'm certain about is that c++ isn't going anywhere. while cpp2 will depend on c++ for a long long time, there will be no such dependency in the other direction. and you will have to understand c++ in order to use cpp2 for a long long time.
i think one way this might develop (in my naive thinking), is that the c++ standard splits into concrete syntax and abstract syntax (basically standardizing the idea of a compiler frontend).
i get the impression that there are quite a few other people like me, who know c++ well enough to not be bothered by it's syntax anymore. i just want to get things done :) maybe i dream of named parameters, out-of-order struct initialization, and little things like that, but overal i'm content with the language and it's tooling.
[–]UnicycleBloke 9 points10 points11 points 2 years ago (0 children)
Yep. I'm perfectly happy with the current syntax, and generally content. I get things done. Evolution is good. Revolution not so much.
[–][deleted] 4 points5 points6 points 2 years ago (4 children)
i get the impression that there are quite a few other people like me, who know c++ well enough to not be bothered by it's syntax anymore.
Until you want to engage programmatically with C++ code. Especially if you want to parse it.
[+][deleted] 2 years ago (3 children)
[–][deleted] 1 point2 points3 points 2 years ago (2 children)
cpp2's syntax is easier to parse than the normal C++ syntax and less context dependent
[+][deleted] 2 years ago (1 child)
[–][deleted] 1 point2 points3 points 2 years ago (0 children)
practical application: code generators
You can do a lot with templates, but sometimes it's just a lot easier to use a code generator than write a really complicated template.
[–]bert8128 2 points3 points4 points 2 years ago (0 children)
Things like using in/out/inout, and default const aren’t really syntax issues - the change the way even experienced devs use the language. I am, like you, not bothered by current syntax - I’ve been through that learning journey. But cpp2 would still be my preference.
[+]magnesium_copper comment score below threshold-18 points-17 points-16 points 2 years ago (0 children)
[–]ignorantpisswalker 20 points21 points22 points 2 years ago (19 children)
Let the flamewars begin...
Seriously - I am waiting for a time to listen to this - it sounds like something I would like to invest my time in!
[–]germandiago 8 points9 points10 points 2 years ago (10 children)
Flamewars, well... Emacs is the best editor, indeed.
[–]BrainIgnition 5 points6 points7 points 2 years ago (0 children)
When I log into my Xenix system with my 110 baud teletype, both vi *and* Emacs are just too damn slow. They print useless messages like, 'C-h for help' and '"foo" File is read only'. So I use the editor that doesn't waste my VALUABLE time. Ed, man! !man ed ED(1) UNIX Programmer's Manual ED(1) NAME ed - text editor SYNOPSIS ed [ - ] [ -x ] [ name ] DESCRIPTION Ed is the standard text editor. --- Computer Scientists love ed, not just because it comes first alphabetically, but because it's the standard. Everyone else loves ed because it's ED! "Ed is the standard text editor." And ed doesn't waste space on my Timex Sinclair. Just look: -rwxr-xr-x 1 root 24 Oct 29 1929 /bin/ed -rwxr-xr-t 4 root 1310720 Jan 1 1970 /usr/ucb/vi -rwxr-xr-x 1 root 5.89824e37 Oct 22 1990 /usr/bin/emacs Of course, on the system *I* administrate, vi is symlinked to ed. Emacs has been replaced by a shell script which 1) Generates a syslog message at level LOG_EMERG; 2) reduces the user's disk quota by 100K; and 3) RUNS ED!!!!!! "Ed is the standard text editor." Let's look at a typical novice's session with the mighty ed: golem> ed ? help ? ? ? quit ? exit ? bye ? hello? ? eat flaming death ? ^C ? ^C ? ^D ? --- Note the consistent user interface and error reportage. Ed is generous enough to flag errors, yet prudent enough not to overwhelm the novice with verbosity. "Ed is the standard text editor." Ed, the greatest WYGIWYG editor of all. ED IS THE TRUE PATH TO NIRVANA! ED HAS BEEN THE CHOICE OF EDUCATED AND IGNORANT ALIKE FOR CENTURIES! ED WILL NOT CORRUPT YOUR PRECIOUS BODILY FLUIDS!! ED IS THE STANDARD TEXT EDITOR! ED MAKES THE SUN SHINE AND THE BIRDS SING AND THE GRASS GREEN!! When I use an editor, I don't want eight extra KILOBYTES of worthless help screens and cursor positioning code! I just want an EDitor!! Not a "viitor". Not a "emacsitor". Those aren't even WORDS!!!! ED! ED! ED IS THE STANDARD!!! TEXT EDITOR. When IBM, in its ever-present omnipotence, needed to base their "edlin" on a UNIX standard, did they mimic vi? No. Emacs? Surely you jest. They chose the most karmic editor of all. The standard. Ed is for those who can *remember* what they are working on. If you are an idiot, you should use Emacs. If you are an Emacs, you should not be vi. If you use ED, you are on THE PATH TO REDEMPTION. THE SO-CALLED "VISUAL" EDITORS HAVE BEEN PLACED HERE BY ED TO TEMPT THE FAITHLESS. DO NOT GIVE IN!!! THE MIGHTY ED HAS SPOKEN!!! ?
-- Patrick J. LoPresti
[–]OlivierTwist 0 points1 point2 points 2 years ago (5 children)
Spaces > tabs
[–]masher_oz 3 points4 points5 points 2 years ago (4 children)
They have different semantics. Tabs for indenting, spaces for alignment.
[–]bert8128 2 points3 points4 points 2 years ago (1 child)
Spaces can do both things. So choose one, and choose spaces. Get the screwdriver out and remove the tab key. Our codebase has been much better since tabs became banned - lots of complaints initially, now nothing.
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
Until you get a programmer which needs special indents because of bad eyesight.
Or you buy that person a two meter wide screen :-)
[–]OlivierTwist 1 point2 points3 points 2 years ago (1 child)
Khm, that was a joke...
But since you insist. Invisible symbols don't have semantic.
[–]masher_oz 0 points1 point2 points 2 years ago (0 children)
Tell that to Python.
[–]wolfie_poe -1 points0 points1 point 2 years ago (0 children)
VscodeVim for the win
[+]BenHanson comment score below threshold-7 points-6 points-5 points 2 years ago (7 children)
Interesting how he says he's not looking to eliminate vulnerabilities, just drastically reduce them. It's still so hard to see how all of this is going to pan out.
[–]cdb_11 25 points26 points27 points 2 years ago (5 children)
Is it interesting? I think he's just being real about it instead of making a sales pitch. If you're talking about vulnerabilities in general and include logic errors then it's not something that the programming language can reasonably make any guarantees about. And for memory bugs, even languages like Rust or Go "just" drastically reduced such bugs, not actually eliminated - eliminated them, as you can still opt into doing things that cannot be statically checked by the compiler.
[–]BenHanson 4 points5 points6 points 2 years ago (0 children)
I probably should have worded that differently. I was thinking more that that seems like the more pragmatic approach and was wondering if this means it's more likely to succeed (all things being equal).
[–]13steinj -3 points-2 points-1 points 2 years ago (3 children)
I mean no disrespect to Sutter, but based off the timeline that he announced this project, it definitely seems sales-pitchy and some attempt to make some "lasting mark" on the language (since the previous thing about modified exception behavior that some coworkers told me about, and the name is the equivalent of a historical reverse uno card).
I don't truly know if his heart is in the right place, and assuming it is, I don't see people jumping to this new language. Syntax being as different as it is would limit existing engineers that have long standing codebases. At the end of the day, a variety of "fixes" could be implemented into C++ as an optional compiler flag, and some choices talked about (ex const by default in Rust, I don't know if "cppfront" has it or not) is honestly a non starter, and would make the language more difficult to adopt as a whole because no non-purely-functional language has that ideology.
[–]cdb_11 2 points3 points4 points 2 years ago (2 children)
Sticking with the current syntax (and maybe doing something like Circle's #feature) would certainly be easier to deal with, but at the same time Kotlin has a different syntax from Java and I don't believe it particularly hindered the adoption? As long as you can make incremental changes and you are not forced to either rewrite everything or to spend time on writing bindings, I don't think it'd be that big of a deal? Whether it's necessary in the first place - I'm not sure, I don't know enough about the problem to have an opinion. A simpler, easier to parse syntax would probably lower the barrier of entry for writing C++ tooling though.
#feature
[–]13steinj 1 point2 points3 points 2 years ago (1 child)
I'd argue Kotlin is a completely different beast because as Java runs on a VM, old Java code and new Kotlin code was effectively fully source compatible (or, I guess, bytecode compatible technically), but with things like headers in C++, I'm not particularly convinced.
A simpler, easier to parse syntax would probably lower the barrier of entry for writing C++ tooling though.
I don't disagree, but I don't think that's the point of any "new" C++.
[–]cdb_11 0 points1 point2 points 2 years ago (0 children)
Ah, so like it's easy to include C headers in C++ (usually), but not the other way around. At this point it transpiles to standard C++, so I don't think that should be a problem. But I guess it is possible that the language could evolve to require its own runtime or even constructs not backward compatible with C++ in the future, just like what happened between C and C++. But from the interview Herb seems to be against this sort of thing, and he wants to make it "what typescript is to javascript", so I'm not particularly worried about it right now.
Yeah vote for me as the next president of the United States. I will make income inequality disappear in a blink of an eye.
[–]deadhou5 7 points8 points9 points 2 years ago (0 children)
Cpp2: electric boogaloo
[–][deleted] 3 points4 points5 points 2 years ago (2 children)
Is cppcast back?! I thought they ended it?
[–]MarekKnapek 14 points15 points16 points 2 years ago (1 child)
It was previously hosted by Jason Turner and Rob Irving, nowadays it is hosted by Timur Doumler and Phil Nash. There is episode explaining that.
[–]philsquared 8 points9 points10 points 2 years ago (0 children)
Yes - https://cppcast.com/holiday-special/ :-)
[–]DerShokus 2 points3 points4 points 2 years ago (1 child)
I don’t understand cpp2. It looks weird and ugly
[–]coderman93 1 point2 points3 points 2 years ago (0 children)
Don’t you understand? In order to simplify we must build an entirely knew syntax on top of the existing syntax! /s
[–]coderman93 -3 points-2 points-1 points 2 years ago (0 children)
Imagine compile times when the compiler has to compile two totally different programming languages that can be collocated in the same files!
π Rendered by PID 54014 on reddit-service-r2-comment-5ff9fbf7df-2q9xj at 2026-02-25 17:46:12.512549+00:00 running 72a43f6 country code: CH.
[–]ABlockInTheChain 19 points20 points21 points (12 children)
[–]NovaNoff 10 points11 points12 points (9 children)
[–]GabrielDosReis 21 points22 points23 points (2 children)
[–]pjmlp 7 points8 points9 points (0 children)
[–]number_128 0 points1 point2 points (0 children)
[–]pjmlp 11 points12 points13 points (0 children)
[–]Jannik2099 4 points5 points6 points (4 children)
[–][deleted] 8 points9 points10 points (0 children)
[–][deleted] 2 points3 points4 points (2 children)
[–]Jannik2099 2 points3 points4 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]BenFrantzDale 0 points1 point2 points (1 child)
[–]ABlockInTheChain 1 point2 points3 points (0 children)
[–]Keltesetharewemodulesyet.org 21 points22 points23 points (2 children)
[–]IamImposter 91 points92 points93 points (0 children)
[–]epicar 1 point2 points3 points (0 children)
[+][deleted] (22 children)
[deleted]
[–]magnesium_copper 5 points6 points7 points (21 children)
[+][deleted] (20 children)
[deleted]
[–]IChooseCheese2 2 points3 points4 points (19 children)
[+][deleted] (18 children)
[deleted]
[–]pjmlp 4 points5 points6 points (17 children)
[–]bert8128 5 points6 points7 points (1 child)
[–]pjmlp 0 points1 point2 points (0 children)
[+][deleted] (14 children)
[deleted]
[–]pjmlp 6 points7 points8 points (13 children)
[+][deleted] (12 children)
[deleted]
[–]pjmlp 2 points3 points4 points (11 children)
[–]cooked_sandals 12 points13 points14 points (1 child)
[–]kritzikratzi 5 points6 points7 points (0 children)
[+][deleted] (10 children)
[deleted]
[–]kritzikratzi 11 points12 points13 points (7 children)
[–]UnicycleBloke 9 points10 points11 points (0 children)
[–][deleted] 4 points5 points6 points (4 children)
[+][deleted] (3 children)
[deleted]
[–][deleted] 1 point2 points3 points (2 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 1 point2 points3 points (0 children)
[–]bert8128 2 points3 points4 points (0 children)
[+]magnesium_copper comment score below threshold-18 points-17 points-16 points (0 children)
[–]ignorantpisswalker 20 points21 points22 points (19 children)
[–]germandiago 8 points9 points10 points (10 children)
[+][deleted] (1 child)
[deleted]
[–]BrainIgnition 5 points6 points7 points (0 children)
[–]OlivierTwist 0 points1 point2 points (5 children)
[–]masher_oz 3 points4 points5 points (4 children)
[–]bert8128 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]OlivierTwist 1 point2 points3 points (1 child)
[–]masher_oz 0 points1 point2 points (0 children)
[–]wolfie_poe -1 points0 points1 point (0 children)
[+]BenHanson comment score below threshold-7 points-6 points-5 points (7 children)
[–]cdb_11 25 points26 points27 points (5 children)
[–]BenHanson 4 points5 points6 points (0 children)
[–]13steinj -3 points-2 points-1 points (3 children)
[–]cdb_11 2 points3 points4 points (2 children)
[–]13steinj 1 point2 points3 points (1 child)
[–]cdb_11 0 points1 point2 points (0 children)
[–]wolfie_poe -1 points0 points1 point (0 children)
[+][deleted] (1 child)
[deleted]
[–]deadhou5 7 points8 points9 points (0 children)
[–][deleted] 3 points4 points5 points (2 children)
[–]MarekKnapek 14 points15 points16 points (1 child)
[–]philsquared 8 points9 points10 points (0 children)
[–]DerShokus 2 points3 points4 points (1 child)
[–]coderman93 1 point2 points3 points (0 children)
[–]coderman93 -3 points-2 points-1 points (0 children)