C++ Is Still Here, Still Powerful With Gabriel Dos Reis

## Metadata
- Author: [[Hanselminutes with Scott Hanselman]]
- Full Title: C++ Is Still Here, Still Powerful With Gabriel Dos Reis
- Category: #podcasts
- URL: https://share.snipd.com/episode/541fa83b-5b8d-48c9-a42a-3616b2210bd8
## Document Notes
## Highlights
- **How Fixing GCC Led To The Standards Committee**
- Gabriel Dos Reis accidentally joined the ISO C++ Standards Committee after trying to fix compiler bugs in GCC.
- He started by submitting patches in 1997 and was invited to meetings once maintainers noticed his contributions.
Transcript:
Gabriel Dos Reis
Thanks for inviting me on the show.
Scott Hanselman
Yeah, thanks for spending time with me. You've been an expert for the better part of 30 years in C++. Learned it in 1992 as part of my undergraduate. But honestly, I have to be honest, I haven't really used C++ since college. So I understand a lot has changed. It is not the language that I learned.
Gabriel Dos Reis
Yeah, I think that is true. I only studied in 95, so you're way ahead of me. And by a series of coincidences, became part of the C++ Standards Committee in 97. And yeah, the language has changed a lot since I learned in 95 and in the 90s, and it's very different.
Scott Hanselman
How do you accidentally end up on the ISO C++ Standards Committee after only two years of spending time with the language?
Gabriel Dos Reis
Oh, well, my professors are no longer around here, so I could confess that I skipped the algebra classes and spent too much time in the computer room playing with GCC and trying to fix Stuff. And I made this error thinking that a compiler is just a software, and if it C++ could be fixed. And trying to fix it is what got me into the standards committee.
Scott Hanselman
So you tried to fix something, and the next thing you know, you're on a mailing list, and the next thing you know, the people on the mailing list say, he sounds like he knows what he's talking About. Come to our meeting.
Gabriel Dos Reis
Yep. My first contribution to GCC was in 97, summer 97, was the implementation of Valery, the numerical components. And it has a bunch of issues. So I reported them. And I was told, well, the way you get them fixed is you join your national body. I was in France at the time, and that was after. And I said, oh, yeah, come over here, but you have to go to the meeting.
Scott Hanselman
Now, back in the day, of course, there wasn't Git. ([Time 0:02:00](https://share.snipd.com/snip/d364f27f-190e-48f5-af19-a3f1812a5871))
- **Backward Compatibility Is A Feature**
- C++ feels old partly because of deliberate backward compatibility that preserved C-era code patterns.
- That stability is a feature: it lets existing business code keep running while new features arrive incrementally.
Transcript:
Scott Hanselman
I mean, there's literally been like 23 versions since I got out of it.
Gabriel Dos Reis
So that's actually a very good question. I don't know if there is one single cause for that. I think the first is C++ has tried very hard to be compatible with C. And then the version that many people learned was the version C with classes. If you were C with classes in the 90s or 2000s, it would still work today. So, you know, that stability in terms of compatibility doesn't in itself sell as, hey, there is a new thing, right? When the Stommer Library came in, it was a complete change in terms of thinking like what people call a paradigm shift. But because of these other aspects of C++, which is going to be compatible with what already exists, there was not a lot of push to say, hey, go and rewrite your stuff. If you already had something that was working, unless you have business incentives to modernize or to rewrite it, the language itself is not going to force you to, hey, you have to rewrite Everything, otherwise I'm not going to compile. So I think that contributed to that fossilization of the idea that this is old and so forth. And the other thing is that collectively, some of the people like me who go around and telling people what C++ is, I don't think we have always done a good job at showcasing what modern C++ is. A lot of people go around and give talk about what it looks like, what it feels like, and so forth. But sometimes, you know, the proof of the pudding is in the inning. Like we have to showcase really good app killer that's written more than C++ and got people into there. Just like the STL itself did, right? The STL says, hey, this is how you do things. It opens people's minds to new perspectives. We need something like that for the newer features.
Scott Hanselman
Yeah, I think you're right. I feel also that the reputation is not as much rooted in what is happening today and more in how it evolved. Because you're absolutely right. You nailed it. I learned C with classes. And then I said, oh, that's C with classes. And I've held that internal bias and all the K&R style code and where I put my curly braces today in 2025. And it's great. You can still compile K&R, like a 1989 K&R style code that'll compile today. But you're, so you're carrying the weight of 40 years of backward compatibility and all the foot guns and everything. Correct. Maybe rust and go, they get to pretend that they just got made up fresh. And what's happening is they're learning all the lessons of 40 years of C++ and then ignoring all the backwards compatibility.
Gabriel Dos Reis
Yeah. It's extremely hard to live with history. Backward compatibility, stability is the feature in itself. If I come to you every two years and say, hey, Scott, I got a new fantastic way of writing, and you have to throw away your previous code, which is working because I have this new thing, I Think at some point, you'll be like, I'm done. Right? But if I come to you and say, hey, I have new stuff for you, I will still make sure what you had before is working because your business depends on it. But when you have an opportunity to upgrade, this is how you can do it. Then the whole thing becomes, yes, I'll take that. Then you prioritize based on what your customers are asking. And sometimes you get a function. ([Time 0:07:18](https://share.snipd.com/snip/9141aeb8-82e9-4270-ac3e-39ec7d9b3379))
- **Old Comments Live Beside Modern Code**
- MSVC code base contains comments and code patterns dating back to the 1980s alongside modern C++ usage.
- Gabriel's team often reverse-engineers older code to capture its intent and modernize safely.
Transcript:
Gabriel Dos Reis
Example, the product I work on daily is the MSVC tool set. There are some comments there that I did from the 80s. Oh, seriously?
Scott Hanselman
Wow, you'll just be lurking around and you'll bump into a comment from the 80s.
Gabriel Dos Reis
And the team is also using the latest features of C++. So this temporal language we're talking about, my team's already practicing that. So when we go in and we find bugs, we need to fix bugs. Then we have to go, oh, why did they write this way? Oh, this is the way we used to express things, right? So we have to do some kind of reverse engineering and then have to walk that idea that was expressed in certain ways through time to what it is today. Capture that wisdom, and then kind of write a doc and try to have the team observe that thing through code review or just like post-mortem summary. Hey, this is what happened. It is how we did it and so forth. ([Time 0:15:00](https://share.snipd.com/snip/3aacb9b6-0365-4cf9-a965-2654e0ed6ed2))
- **Start Teaching With Contemporary Problems**
- Teach and adopt modern C++ by focusing on current engineering problems, not language history.
- Use constexpr and modern features to get compiler help and make code safer and clearer.
Transcript:
Gabriel Dos Reis
I tend to structure my teaching around problems that I consider contemporary. Yes, there is the historical view of the language, like, you know, behind the two classes. And that is interesting if you're doing archaeology or history of C++, which are really interesting topics in themselves, right? But if your job is to get something done and engineer, not just program, I make a distinction between programming and engineering, right? So when you're doing engineering, you're not trying to have the cutest solutions possible. You're trying to have something that is solid, that can sustain the test of time over, say, five, ten years. Because you don't have the luxury of going every six months and updating the new thing. You want the program to be dull. But if it is too exciting, no, you've lost everybody. You have to give it dull and robust. So that is engineering. That's what you want to do. So I'll take just a couple of problems from the domain and say, well, here's what we have. How do we express constraint, right? So usually engineering is, you have lots of constraints. They tend to be intentioned. And then you try to find a path that gives you something that is robust and that you can teach the next generation. Because if you're successful, you're probably going to get promoted or you're going to get help from someone. And if you require the person that's going to help you to be at least as smart and as cute as you are, maybe they're smarter, cuter, and they'll get promoted by you. Right? So you want to make it accessible to the math. And that is what I consider the good part of programming, engineering program, and then expressing those ideas in C++. So these days, I would say, yeah, let's start with costexper by default, because we know that if you declare a global variable, you shouldn't have many of those. But if you did, and then you have to rely on runtime initialization, you know if it comes out there. So what you want to say is, well, if it is constant, I want to use CostExperter to ensure that if I ever accidentally make a dynamic initialization, the compiler will tell me. So I'm getting assistance from the compiler. Back in the 80s, we were all doing template metaprogramming. Let me show you how cute I am and so forth. But that doesn't scale. If you have a constexpr function, all you want to do is raise the runtime computation to compile time. So you want to express with the same notation to make it easy for people to access. ([Time 0:18:28](https://share.snipd.com/snip/9d510494-cebd-414a-83bb-2df25d45f93e))
- **Modules Forced Tooling Work To Happen**
- The C++ committee neglected tooling like package management and build systems for years.
- Modules forced attention on these tooling gaps and spurred harmonization efforts across the ecosystem.
Transcript:
Gabriel Dos Reis
So you're absolutely correct that an area that has been neglected by the C++ community and committee is tooling aspects like package management and build systems and editors and all Those kind of stuff. That has done two things. In one way, it has allowed the flourishing of different ideas. Like today, we have VS Code. Visual Studio, we have Sea Lion. People go in different directions to try to explore ideas. And that way, we don't suffer from monoculture, long way of thinking. On the other hand, it has fractured the community, make it much easier. It has fractured the community, making it much more difficult to advance things like programming should be dull. Like if today, if I want to start with a beginner and show some graphics, it's much more difficult than it needs to be. With Java, just, you know, have package, downloads, done. In SQLite, it's a little bit more difficult. So I agree.
Scott Hanselman
So it feels like you're saying that the language evolved, but the ecosystem, which is not the language, may be a little rough around the edges. And in a managed ecosystem, managed by maybe a bigger community or a company, Python, Node, Rust,.NET, a new developer might have a little bit less, you know, rough around the edges. But C++ is very popular. Maybe the ecosystem could use a little love and you could come up with a build manager. I agree.
Gabriel Dos Reis
You're right on point. So when I designed a module system for C++ in 20, so these problems we had before, everybody was dealing with them, but now with modules, it became in your face. And one of the things that I asked Herb Soder when he was running the C++ community was to create a study group dedicated to tooling. So we have, you know, somehow the company has not acknowledged, hey, build systems exist. So we have been doing a lot of work to kind of harmonize the various ways of invoking the compiler, setting the build systems and building modules and so forth. ([Time 0:22:24](https://share.snipd.com/snip/d5999b81-ee30-435b-9d0d-301a19f4007d))
- **Improve Safety Incrementally With Profiles**
- Use C++ profiles and contracts to improve memory safety incrementally rather than rewriting in a new language.
- Combine static analysis and clear contracts to scale safety without a disruptive revolution.
Transcript:
Scott Hanselman
Yeah. And now another series of things that have been neglected, or at least the community thinks have been neglected, is like safety profiles. All the classes of bugs that would have the news, have the hacker news, believe that everyone is rushing to rust because it's just safer, it's just better. C++26, which is in flight right now, promises to basically solve an entire class of bugs around bounds and type and lifetime and arithmetic. Yes.
Gabriel Dos Reis
So that was an area where Bjarne Struston and I, you know, collaborated again and with some help from Herb Sutter. So the basic idea is that it is possible to write memory-safe programs in C++. So it is possible. But what is actually at issue is not the possibility. It is not truth of existence. It is the scale. How easy is it by default to write memory-safe programs? I think that is a real problem that we need to tackle. And that is what Bianni and I have been titling. Again, the idea is evolution. You can do revolution by just throwing everything out, or you can have everything that is working and upgrade in place. And C++ profiles are one way of getting there. And I actually believe it's a very good way of doing it. Unfortunately, we were not able, Bianca and I were not able to convince the C++ committee to get profiles into C++26. We're pursuing that aspect parallel to C++26. Right now, there are some other features that have been considered, like contract, that if done properly, would allow you to express the requirements and guarantees of a function. What does a function require of its argument once execution is done successfully? What does it guarantee? If you can express this thing very simply, then you can take advantage of code analysis, like whether it is static or runtime instrumentation, to actually provide more guarantee or Mitigation measures, right? Unfortunately, there are still aspects of that feature that are not really there, and we are trying to fix them or at least move them into a parallel track that will be released at the Same time as C++26. ([Time 0:25:13](https://share.snipd.com/snip/dede5e47-a7eb-4d41-9231-f60c2cd8d1a9))
- **Modern Intro Material Exists Now**
- A Tour of C++ (second edition) presents idiomatic, contemporary C++ suitable for 2023+.
- Modern examples now start with modules and reflect current best practices for experienced programmers.
Transcript:
Gabriel Dos Reis
Bjorn Instrastrope wrote an updated book called A Tour of C++, I think the second edition, which talks about C++ 2023. As a matter of fact, the old Halo World program now starts with import module students and int man, you know, see out and print, right? So it's really trying to cheat you right out of the gates, the modern C++, the contemporary C++. Contemporary, that's the word.
Scott Hanselman
Contemporary idiomatic modern C++. Yeah. Because that's what powers AAA games, right? That's what powers big stuff.
Gabriel Dos Reis
Yeah, I will send you a link to that book. I don't own any stock in the sale, but I think, as you mentioned, it is a very good resource for people starting to program in C++. ([Time 0:28:36](https://share.snipd.com/snip/3f230093-ab96-4ca4-b3f4-64859e5e52d7))
- **Learn Multiple Languages, Not Just C++**
- Learn multiple languages to become a better software engineer and broaden mental models.
- Pair C++ with a language like Haskell to gain different paradigms and enrich design thinking.
Transcript:
Gabriel Dos Reis
Yeah. If you want to be a professional software engineer, just learning one language is not good. You need to know at least two or three different languages, not C and C++. Let's say C++ and Haskell. Why? Because they are completely different paradigms. ([Time 0:33:17](https://share.snipd.com/snip/8692b2e9-d32c-44f6-91f1-85ebf0412d3c))