CppCast - Visual Studio 2022

Episode Date: November 4, 2021

Rob and Jason are joined by Sy Brand from Microsoft. They first talk about the recent CppCon conference, the hybrid format and some of their favorite talks. Then they talk to Sy about the upcoming Vis...ual Studio 2022 release, what's new in the IDE and new features and improvements for C++ developers. News WG21 October Mailing CppCon 2021 Virtual Trip Report, A User Story Extending and Simplifying C++: Thoughts on Pattern Matching using is and as - Herb Sutter Links Visual Studio 2022 Release Notes Visual Studio 2022 Launch Day Event C++20 DR tracker Sponsors PVS-Studio Learns What strlen is All About PVS-Studio podcast transcripts

Transcript
Discussion (0)
Starting point is 00:00:00 Episode 324 of CppCast with guest Cybrand recorded November 1st, 2021. Sponsor of this episode of CppCast is the PVS Studio team. The team promotes regular usage of static code analysis and the PVS Studio static analysis tool. In this episode, we discuss CppCon trip reports and ISO papers. Then we talk to Cy Brand from Microsoft. Cy talks to us about the upcoming Visual Studio 2022 release and what's new for C++ developers by C++ developers. I'm your host, Rob Irving, joined by my co-host, Jason Turner. Jason, how are you doing today? I'm okay, Rob. How are you doing?
Starting point is 00:01:23 Doing good. It is November 1st, so Halloween was last night. First time trick-or-treating. We skipped it last year, so it was nice doing that in the new neighborhood. How about you? What's your neighborhood like? Do you get thousands of kids around, or what? More than we were used to in my previous neighborhood, so that was good. We certainly got plenty of kids. We gave out over 500 pieces of candy oh wow so it was at least 200 kids i think yeah that's a lot i don't think we had that much
Starting point is 00:01:54 but we had more than we're used to a previous uh yeah halloweens yeah you were recovering from cp on cpp con okay uh i think so. Mostly. That was exhausting. Well, I started it with two days of training, which I'm not... It's a thing to build up to. It's its own thing. So my voice was wearing out pretty good by Monday,
Starting point is 00:02:18 and that's the first day of the conference. And then I gave my talk on Monday, and then I spent the rest of the week recovering from the Saturday and then i gave my talk on monday um and then i spent the rest of the week recovering from the saturday and sunday and monday awesome okay well at the top of every episode like sort of piece of feedback uh we actually got a lot of comments on reddit with last week's episode with bryce talking about you know stuff going on in the ISO committee. This one comment, I'm not going to read the whole thing,
Starting point is 00:02:50 but they were basically saying how they're a little disappointed that the static reflection is not getting more priority in the standards work. They like the sender-receiver approach replacing the executors, but unhappy that there's not more work on static reflection. And Bryce himself pointed out that reflection is a language feature. Sender receiver is a library feature. So there's different people working
Starting point is 00:03:15 on those different things. They can happen in parallel. Just a good reminder. And we are talking to Bryce, not someone who is in language evolution. Bryce's focus is on the library features. Yeah. Okay.
Starting point is 00:03:27 Well, we'd love to hear your thoughts about the show. You can always reach out to us on Facebook, Twitter, or emails at feedback at cppcast.com. And don't forget to leave us a review on iTunes or subscribe on YouTube. Joining us today is Cy Brand. Cy is Microsoft C++ developer advocate. Their background is in compilers and debuggers for embedded accelerators, but they're also interested in generic library design, metaprogramming, functional-style C++, undefined behavior,
Starting point is 00:03:51 and making our communities more welcoming and inclusive. Cy, welcome back to the show. Hey, thanks for having me again. How long has it been that you've been the Microsoft Developer Advocate now? Three years, almost exactly. I joined just before CppCon three years ago. That's right. I just, you know, I do love
Starting point is 00:04:09 our developer advocates in the community. It's so helpful to have people like you, and I'm just giving a random shout out here, that we can on Twitter be like, I don't understand what's going on with this product. And our developer advocates do, generally speaking, a really good job of getting back to us really quickly.
Starting point is 00:04:25 It helps that I'm terminally online. Even our developer advocates do generally speaking a really good job of getting back to us really quickly. So yeah, it helps that I'm like terminally online. Even, even if someone just doesn't add me and they're just like, Hey, this thing doesn't work in visual studio. Sometimes I see it and I like show up out of the shadows and, and get something sourced. They're like,
Starting point is 00:04:39 how did you even find this? And like, I'm just on Twitter 24 seven. And I don't think we mentioned this yet timor just filled phil's role and his demographic head back at jetbrains now nice yeah that's cool yeah all right well so we got a couple news articles to talk about feel free to comment on any of these and we'll start talking more about uh you know new updates in visual studio and uh maybe some of the stuff you got
Starting point is 00:05:05 out of cpp con and presented on last week okay sounds good all right so the first one is the wg21 october mailing and it is a big one uh i saw that there was a new paper in here that i thought you'd be interested in jason which was uh i can't find the name of it now, but it's constexpr-classes, I believe. Yeah, constexpr-classes. Someone told me recently that it looks like that will actually get approved in time for C++23. Oh, wow. That's good. And for our listeners, it makes sense. It's basically instead of having to mark every member of a class as constexpr,
Starting point is 00:05:44 if you want the whole class to be constexpr, you could just mark it at the class definition. Yeah. Which then leads to relaxing some constexpr restrictions from Barry, P2448, which I just had to read that one because I had no idea what that was about. Well, it's a brand new paper. But it's about making some of these things,
Starting point is 00:06:04 like if you mark the whole class constexpr, but's a brand new paper. But it's about making some of these things, like if you mark the whole class constexpr, but in some context, some parts of it can't be, then it doesn't cause other cascading problems. Okay. So any papers you wanted to highlight? I was particularly interested in this one about coroutine elision. The title is quite mouthful. Allow a programmer to control and detect coroutine elision by static constexpr
Starting point is 00:06:27 bool should elide and coroutine handle elided so the idea I just had a glance at this paper but my understanding is that it allows you to both say that your coroutine should be elided where
Starting point is 00:06:41 elision for coroutines means allocated on the stack instead of the heap. And you can also request, you can say to the compiler, hey, was this thing elided or not? So I imagine this is really useful in embedded contexts and places where you really don't want these things to be allocated on the heap, I guess, like video games and real-time systems
Starting point is 00:07:05 and a bunch of other places. So that makes a lot of sense to me. An interesting tie-in to that was a talk at CBPCon where the developer used coroutines to emulate exceptions in an embedded context where exceptions aren't allowed. It was a little bit of a mind-blowing thing to watch, but part of it was all of the hoops jumping through to convince the compiler to elide this coroutine,
Starting point is 00:07:36 where he really just wanted the machinery to come in. So I could definitely see that there. And I could even see that this might be a stepping stone to actually allowing coroutines in a constexpr context if it's the best way to describe the problem you're trying to solve. Yeah, that would be cool. I think I also liked the forward-like paper from this. This is kind of an extension of stuff which was in the deducing this paper,
Starting point is 00:08:01 which I was co-author for, and I actually got approved for C++23, a last plenary, alongside my monadic extensions proposal for std optional, which I think we talked about like three years ago on this podcast. So it's cool that now, like three years later, it's actually going to be in the standard. Yeah, that's fun. Do I have those going through, huh? Yeah, and for our listeners, I don't think we've talked about deducing this
Starting point is 00:08:26 in too much depth on the show, but I think we're going to have Gasper on the show soon, so we'll definitely be digging into that and probably talk about Forward Like as well. Yeah, sounds cool. I couldn't remember if we talked about it on the show or not because Ben gave a meetup talk about it at my meetup and then also presented it at CBPpp con and then that led to a bunch
Starting point is 00:08:46 of other conversations i had a bunch of conversation with people cpp con about doing the deducing this so uh yeah i couldn't remember if we talked about it right okay next thing we have is a cpp con 2021 virtual trip report and this is from Javier Estrada's blog. And yeah, this was his take on experiencing the conference virtually, which is the same way I experienced it this year. And I think, Sai, same for you as well. Yeah, me too. And I definitely agree with what he said.
Starting point is 00:09:20 He talked about how the website Digital Medium was really nice for just very easy access of the presentations. You could just see, you know, just refresh the page and see what was currently going on or what was about to start and click on those links and quickly open up the zoom for the, uh, the virtual presentation, um, gather town. I don't know about you, Cy, but I did like set up my avatar when i first got the links for it and everything and then i never went back to it yeah um i know i really like the idea of gather time yeah um so for people who aren't aware of it it's like a uh kind of top down um
Starting point is 00:09:58 obviously old style like jrpg style yeah um so you can like walk around and there's proximity chat so as soon as you get close to someone then if you like then you can have your video and your audio broadcasted and also they they recreated the entire uh venue in gather town which is really really cool um and they had things like puzzles that you could do or games that you could join or you could walk to the lecture hall for the talk and join a Q&A session there. So there was so much space that it was difficult to... When you're at a conference, physically, you're just walking around and you bump into people, or you have a sense for where the most people are at the moment or something, or you see
Starting point is 00:11:00 congregations of people, whereas in GatherTown it was quite sparse and in a lot of places so i didn't end up having a lot of conversations just walking around the the virtual venue but it's a it's a shame i feel like there was more i mean i guess last year too was all virtual but i i thought i can't remember the name of the platform these last year but remo like having just the different tables and you can move from table to table and get a you know multi-person chat i thought that was pretty well yeah i've used to get both once and i definitely like to gather town better you did okay i did because of this nature of being able to walk past someone and see if there's a conversation happening
Starting point is 00:11:41 although i didn't use it at cpcon so so I can't speak to that experience at all. Well, that's not fair. I used it for like 10 minutes in my post-conference. I think it would have worked better if it was just a little bit smaller. But I think the organizers did a really, really great job at tying together all of those different platforms, like using Zoom for the actual virtual talks
Starting point is 00:12:03 and the Q&A in Gather Town and having that digital medium kind of lobby or landing page. I think they did a really, really good job. Yeah. I've just heard so many different numbers. Of course, we're going to have to get John on here at some point for a post-mortem or something, because this was a large hybrid conference.
Starting point is 00:12:21 And I think... But the numbers that I heard were something like 1,100 or 1,200 registered for remote, hybrid conference and i think but the numbers that i heard were something like 11 or 1200 registered for remote which uh it sounds like you never saw nearly that many in gather town yeah and then something like a little less than 250 registered for on-site but a little bit more than 200 actually came on-site which if that's, that's a fairly large amount of attrition for people who paid for on-site tickets. Yeah. Yeah. But I mean, with the numbers that were there, like 10% of the conference was my local users group. So every time I turned around, I was
Starting point is 00:12:59 hanging out with the people from my local users group, which was cool on one hand and also just a little strange on the other. What was the food like at the Go Look Rockies this year? Well, do you mean like the restaurant food or the snacks and vikings and stuff provided by the conference? Yeah, it's like a couple of years ago when I was there, it felt like there was the small choice of restaurants and they were all very expensive and that was mostly it. The same but smaller.
Starting point is 00:13:30 They only had like half of their restaurants open or something like that because of understaffing and underutilization of the hotel and conference center. I mean, everyone's, I think, feeling like dealing with understaffing issues right now so but I mean
Starting point is 00:13:47 it seemed to work out for the people that were there they all were fed but they probably didn't like how much
Starting point is 00:13:54 they had to pay for food yeah if you worked it carefully you could have filled up on snacks in between sessions though
Starting point is 00:14:01 because there was things that you could consider meal like like you know tiny empanadas and stuff and yeah so fill up on the churros because dude those things were heavy uh anything else either of you want to bring up from uh this blog post he the author also lists their favorite sessions and uh jason your your constexpr talk is in here
Starting point is 00:14:23 it's the only reason I put this link in there. I saw... Did either of you watch Walter's talk on correctly calculating min, max, and more what could go wrong? No. I haven't watched that one yet. Oh my goodness. I heard that it wasn't actually going to be recorded. And sometimes Walter, I think, chooses that.
Starting point is 00:14:43 So it's possible it won't be available for play later but you know it's a bit of a it's some things that some of us who've been paying attention have heard like should men like men should always return the first parameter if they're equal and mac should always return the second parameter if they're equal but that's not how the standard library was designed and wal Walter goes into some of the implications of this and why we should care and implementing all these things. And it was a good talk. Sounds cool.
Starting point is 00:15:12 Yeah. Okay, and then the last thing we have in the show notes is that some of the talks, at least some of the keynotes, are already on YouTube, including Herb Sutter's talk, which was Extending and Simplifying C++, Thoughts on Pattern Matching Using Is and As. And I did watch this one, and it was definitely one of my favorite talks. As someone who does a fair amount of.NET development,
Starting point is 00:15:38 I'm familiar with using Is and As, and I would love to have those features in C++. What are your thoughts, Jason? Sorry. I didn't watch this one live because one of my talks was at the same time, but I did watch it this morning when I saw it was in the show notes. Yeah, I like this a lot. I think one of my favorite things about it is that this inspect entity is an expression, not a statement. I really like playing around with
Starting point is 00:16:06 other languages and Rust and things like that where there are a lot more things which are expressions, which in C++ are statements, like even ifs and things like that. It's a really nice ergonomic feature and having that for
Starting point is 00:16:21 inspect is really nice. This just lets you plug it into some part of a larger expression, just match something, get a result, and then immediately use it without having to create a new variable or assign it to anything. I think one thing that I was... Sorry, go ahead. Oh, no, I just said I had not noticed that inspect was an expression.
Starting point is 00:16:43 Yeah, because that is fundamentally different than switch or whatever. Yeah, there's a slide in Herbstalk where he uses an inspect in the middle of a see-out expression. It's quite nice. I think one thing I wasn't sure about was the fact that it uses the same syntax to ask questions about the value and also the type of something. And sometimes it would not be clear what you're, you're necessarily asking about,
Starting point is 00:17:12 because you can, you could say, um, some expression is, and then you could have some name and that name could either be the name of a, a function, which will be evaluated or it could be a concept or uh or like a type alias or or something and without knowing what
Starting point is 00:17:35 that um exactly what that is you don't know whether you're asking a question about the value or the type of the the thing on the left hand side. But maybe it turns out to not be a problem in actual use. It's just something that I saw and was like, I can see this being confusing in some cases, but maybe I'm just wrong and it's clear in context. I feel like a lot of people around the conference expressed a similar concern of like, if you're asking is, and in some cases you're saying, is this're asking is and in some cases you're saying
Starting point is 00:18:05 is this a variant and in some cases you're saying does this variant hold this particular type and the confusion that could come there. I definitely liked inspect but if you heard my question at the end as makes me
Starting point is 00:18:22 nervous because Herb is like look as replaces these 20 different types of cast. And I'm like, but those mean different things. Like, what? Now, how do we distinguish between these things when it does matter and people are using as all over the place because it's so ergonomic and so easy to use?
Starting point is 00:18:42 That definitely makes me nervous. We wouldn't be taking away the things that's you know quote unquote replacing no i'm just afraid that it would be that it's going to be so easy to use everyone will default to using it and then the then i'm just going to be more difficult to teach like actually you want to avoid using as in these three cases and you want to use explicit cast here because you're doing something different you have the risk of a narrowing conversion or you're implicitly creating an expensive
Starting point is 00:19:08 object to create or whatever. Yeah, or you want to make sure you're not doing a dynamic cast in this particular case or something like that. Right, yeah. Okay, well I guess moving from there Sai, is there anything else you wanted
Starting point is 00:19:23 to start off with, with, uh, your thoughts from CBP con before we move on to, uh, what's new in visual studio. Yeah, I think I,
Starting point is 00:19:32 I didn't end up watching a whole lot of talks cause I had two talks that I was giving myself. I had one on what's new in visual studio. And then I had one that was with, um, Marianne Muparu. And then I had one talk with Chris DiB Muparu and then I had one talk with Chris DiBella on documentation
Starting point is 00:19:47 in the era of concepts and ranges and then I was also on the Code of Conduct team so I had just like a lot of things to do so I didn't end up watching a whole lot of talks I did really enjoy Kevlin's talk on Six Impossible Things which was the opening talk
Starting point is 00:20:03 because talks are always just really fun and and engaging um i really liked chris's other talk on discovering the user-facing concept like looking at the the patterns in your code and trying to extract concepts from from algorithms and things like that uh a lot of people told me that your talk jason was really really good like i asked at the start of one of my talks, I asked everyone in chat what their favorite talks were, and a bunch of people said that yours was one of their favorite talks. So I'll have to go and watch that one. It was exciting to be able to speak again in front of people,
Starting point is 00:20:35 but I was in the biggest room, and there's like 40 people there. It might have been a little bit more than that. It felt like it was, you know, and all the chairs were spread out. So in a way that made it feel more full, but also less full at the same time. But yeah, I had, I had a lot of fun with that talk.
Starting point is 00:20:53 So hopefully you like it when you go to watch it. Yeah. All right. Well, so you mentioned you, you did a talk on what's new in visual studio with, uh, Marion Luperu.
Starting point is 00:21:03 Uh, I guess let's start with that. When is the new Visual Studio version coming out, first off? 8th of November, so a week from when we are recording. Yeah, shoot. When will this episode be released? This will be Thursday or Friday, depending on your time of day, I guess. To everyone listening listening imminently
Starting point is 00:21:27 the Monday after this goes live is what we're talking about there will be a launch event which I'll send you folks a link to the event for the show notes but yeah there will be a launch event at 1530 UTC
Starting point is 00:21:44 whatever that ends up in your your time zone and there's going to be who knows because everyone's changing daylight time on on sunday and one week we will be right before this yeah i have no idea whatever it'll be at some time in the morning yeah so there's going to be a keynote right at the start um on like everything or like the broad strokes of what's new in visual studio 2022 and uh there's going to be three c++ specific talks one on um it's general uh c++ for uh sorry visual studio for c++ developers in general uh which i'm doing and then one on for games developers and one
Starting point is 00:22:27 for cross-platform developers. And they'll all be like just 20, 30 minutes long or something, so a bit shorter sessions, pretty demo-heavy.
Starting point is 00:22:39 Should be fun. Nice. Well, my birthday is actually next Monday, so thank you for all that. I'm looking forward to it.
Starting point is 00:22:44 The birthday present, just for Rob. Well i i guess before we we dig into like the new c++ stuff though can we talk about what's kind of new and just visual studio 2022 generally yeah yeah so i guess the one of the kind of flagship things is that it's now 64-bit you know that thing that people have been asking asking for endlessly for years and years and years. But it's there now. So if you have, you know, those massive projects, which really push the memory limits of 32-bit applications, then hopefully you will have a much better time with Visual Studio 2022. You know, for a long long time we were starting to
Starting point is 00:23:25 move bits and pieces out of process, but now the whole IDE is 64-bit. So that should help a lot of things. And that means that also when you create a new project in Visual Studio
Starting point is 00:23:41 for C++, it's going to target 64-bit by default, which is another thing that people have been asking for for a long time. A few other things on the aesthetic side, theming support. People really like the Visual Studio Code themes, and
Starting point is 00:23:57 now you'll be able to do the same kind of thing in Visual Studio and port themes over from VS Code as well. Another thing is color-coded tabs, so you can organize your tabs in your editor a lot more in a neater way.
Starting point is 00:24:14 Is that like a manual thing, or is it based on file type, then it's automatic? I haven't used it myself, so yeah, I believe we have a blog post about it which will have more details um one thing that i like a lot is uh hot reload which is basically you click a a button to to turn on hot reload or hot reload on saving your file and then if you're debugging and you
Starting point is 00:24:42 make a change and you save it then it can recompile part of your application on the fly and then um load it in while your program is still running without you having to hit a break point or or pause um so like in my works really well um in my demo at cppcon for, I had a random number generator algorithm which was implemented using coroutines and was just generating an infinite stream of random numbers. And I had it generating random numbers from like zero to a million or something, and then I just changed that and you could see that the console had this this big line of just infinitely generating random numbers and I switched it so that it was generating
Starting point is 00:25:28 from 0 to 10 saved and then the console you saw all the numbers shift so that it was just between 0 and 10 so just save recompiles just that part loads it in and don't have to pause or anything
Starting point is 00:25:42 so that's really useful for interactive applications, especially like video games, things like that, where you're already debugging, you want to make a small change, tweak some parameters or something, see how it affects things. You don't have to pause,
Starting point is 00:25:58 you don't have to recompile everything. You just save and on you go. I have to admit, I've never used Edit and Continue, because it makes me nervous. I'm like, it can't possibly work right. So I always... Maybe I should start trusting it, I guess. Yeah, it's powered by the same kind of technology.
Starting point is 00:26:16 It's just taken to the next step, I guess. A few other things. Dependent breakpoints. things uh dependent breakpoints so you know we have conditional breakpoints already but dependent breakpoints is it will only stop at a breakpoint you've set as dependent if it stopped at a previous breakpoint as well so you can like set up dependencies between breakpoints which is kind of nice you know if you have a like a certain path through your your application which you're trying to debug you know if you have a like a certain path through your your application which you're trying to debug you know you've got a lot of branches or um certain parts of control flow
Starting point is 00:26:52 that you want to make sure that you're hitting a one path then you could set a bunch of break points and then make them dependent on each other so that you're you're only getting the the path that you want so what does the the interaction look like for that? You do file or new breakpoint, right-clicking on a line. Yeah, new breakpoint, right-click on the little red breakpoint symbol, configure it, kind of similar to if you ever set a condition on a breakpoint before, it's kind of similar interaction. So you just get a list of other breakpoints
Starting point is 00:27:25 and just pick one as your dependency? Okay. That sounds like something that could really help if you're really in the weeds in your debug. Yeah, yeah, yeah. You know, when you be staring at it for hours and you're like, I need exactly this path.
Starting point is 00:27:42 I know I've been there myself. Right, definitely. And I guess the other general Visual Studio 2022 thing is multi-repo Git support, so you can have a single solution
Starting point is 00:27:57 with multiple Git repos, and you can interact with them all as you would expect. So if you want to make a change, which affects a bunch of different repos, then you can make those changes and then make commits across all of them and push them all, or you could just push changes to one repo or whatever you want.
Starting point is 00:28:22 So if you have a project which you don't want to have multiple instances of the ID open or you don't want to have to switch between things, then you can just have them all open in a single solution and just switch between them as you want. Interesting. That sounds really nice. I work on a project that does
Starting point is 00:28:40 live within two different repos and I have been hesitant to use Visual Studio for for git but maybe i'll give it a shot with this yeah yeah so i think those are the the main general like non-c++ specific um vs 2022 changes i'm kind of curious i mean we've all been asking for 64-bit visual studio support but do you have an idea for how many people this will like actually affect how many people are working on projects that are so large that visual studio the ide runs out of memory yeah i don't have enough i don't have numbers on it but enough people that we made
Starting point is 00:29:18 the change like enough people have been um shouting at us for this and saying that this causes real problems for their projects in the real world. So it was a lot of engineering effort in order to bring everything into 64-bit and make sure that everything's all working properly. And there's still a lot of engineering work and then validation work and testing and things like that so um there was a lot which went into this so um yeah we decided that it impacts enough people that um that it matters i'd imagine probably some internal developers that are probably getting good benefits from this like office development must be a huge
Starting point is 00:30:05 repository yeah but as i i spent some time with some of the office people uh at cp con and they're like yeah you don't open all of office in visual that's not a thing maybe we'll get there i don't know what it's like with 64-bit butbit but well yeah an office is like 100 billion lines of code or something anyhow now for those of us who aren't working on projects this large does 64-bit build offer any other advantages is it faster or more efficient
Starting point is 00:30:38 in any way or I think I don't have any measurements on on performance improvements specifically. One of the reasons that we're always somewhat reticent to just say, hey, yeah, we'll just move to 64-bit is it does come with... It's not as simple as 64-bit being better than 32-bit, because suddenly every pointer in Visual Studio is twice as large,
Starting point is 00:31:06 and that has actual... That's something you actually have to care about. So yeah, I don't have any hard performance numbers but we've done a lot of validation work to make sure that it is running as smoothly as everyone
Starting point is 00:31:21 should expect. Okay. Sponsor of this episode of CppCast is the PVS Studio team. They developed the PVS Studio Static Code Analyzer. The tool helps find typos, mistakes, and potential vulnerabilities in code. The earlier you find an error, the cheaper it is to fix, and the more reliable your product releases are. PVS Studio is always evolving in two directions. The first is new diagnostics. The second is basic mechanics, for example,
Starting point is 00:31:50 data flow analysis. The PVS Studio Learns What STIR LEN is All About article describes one of these enhancements. You can find the link in the podcast description. Such articles allow you to take a peek into the world of static code analysis. Well, I guess maybe we should dig into some of the C++ specific features of Visual Studio. Okay. So, I mean, first of all, are we going to be feature complete for C++ 20? So we are feature complete on all C++ 20 features that weren't subject to late ABI breaking changes. So basically there was
Starting point is 00:32:30 late on in development of C++20 standard there was a few defect reports which got sent in and which are ABI incompatible with what we had before.
Starting point is 00:32:47 So we had implemented the previous versions, which weren't modified by the DRs, but after applying the DRs, those are ABI incompatible, and we're still dealing with those. I think most of them we've implemented already. We do have a tracker on GitHub for it. I believe the three main things were ranges, because now ranges no longer are required to be default constructable. And there were some changes to format,
Starting point is 00:33:20 and then that had knock-on changes to formatting for parts of Chrono. So I think most of those are now completely done and merged into our STL repo. I think there's one which has still not been implemented yet, and there's a few which have been implemented and are undergoing review. So we should be done with those. But apart from those, everything else is feature complete. And we now have the std C++20 switch available. So if you pass that, then you'll have all of the other C++20 features.
Starting point is 00:33:55 And we say that those are all production ready now. You can go use them. They're going to be ABI stable. And yeah, and I'll also send you the link to the tracker for those DRs so people can check them out if they want. So for those of us who have been doing std colon latest or whatever it was to get C++ 20 features, we should now spell that 20 instead of latest.
Starting point is 00:34:21 Unless you want the... 23. Unless you want the... Well, 23, yes. Unless you want either the C++23 stuff, because we do have some C++23 stuff already, but also those things which are subject to DR. So if you want ranges and format and those parts of chrono,
Starting point is 00:34:43 then you would have to pass C++ latest. Oh, okay. And then, yes, on C++ 23, we do have a few features, standard library features from C++ 23, like art pointer. And art pointer contains for basic string and basic string view
Starting point is 00:35:03 and a few other small features. And I think all of those were contributed by the community because the STL is open source now. So folks contributed those features and then we got those all reviewed and tested and merged in and now they're in. So yeah, thanks to everyone who contributed. I have a completely random question.
Starting point is 00:35:25 Besides those library things, do you know which language feature from C++ 20 was the last one to get in? Like which language feature was maybe the hardest or took the longest to implement or something like that? Oh, I know it's a very random question to ask. Uh, I don't remember off the top of my head.
Starting point is 00:35:43 Okay. I would have to check the check if you went through the release notes for 2022 preview I think you would probably find what the last feature was but I don't recall off the top of my head did you all have a big old virtual
Starting point is 00:35:58 party when you said we're 20 complete I don't know. I'm like eight hours ahead of everyone else. So maybe they did and I wasn't invited. Well, maybe let's dig into a few of those though, because I saw that in your demo that you did show the module experience
Starting point is 00:36:22 for Visual Studio 2022. And that looks pretty neat. Yeah, so the current status of modules is that we have MSBuild support for modules. So if you have a bunch of modules in your project, then MSBuild will scan those to work out the dependencies and the build order. So you don't have to specify it yourself,
Starting point is 00:36:41 which is really handy. We also have support for IntelliSense. So if you, you know, once it's scanned all those modules, you can type like import and space, and then it will give you completion for your modules. It has navigations, if you like control click or F12 on a module import name, then it will take you to the module. So there's a bunch of productivity features for modules there. For CMake, we're working with Kitware to get a similar kind of experience as what we have in MSBuild, where modules are scanned automatically. We do have a flag slash scan dependencies which outputs information about the dependencies about the module dependencies
Starting point is 00:37:30 so that CMake can then consume that so we just need to get everything linked together but we hope to have that in the not too distant future so folks using CMake can have all of their module dependencies
Starting point is 00:37:46 work type them automatically as well. Very cool. Awesome. Jason, you want to ask something next? Sorry, it looks like you had something ready to go. I did not. I was just thinking. Thinking about modules. I was thinking about modules, in fact, because there was a talk at cbp con that
Starting point is 00:38:05 was the current status of using modules with visual studio and cmake and all that that kind of discussion and i missed that talk and kind of wish that had gone to it so and i'm glad to hear that you all are working with kitware to figure this out and And modules is one of those things, like I know that I'm supposed to be excited about it, but given that one of the three platforms that I need to work with supports it, can't get excited yet. So I'm very curious to see
Starting point is 00:38:40 when it'll be that GCC and Clang catch up there. Yeah. Looking at Clang's, this is completely off topic, and maybe I'll regret saying this, but since we're on the air here, looking at Clang C++20 support, I find myself curious if Clang will ever support modules fully or not from C++20.
Starting point is 00:39:04 We'll see. Not that either of you can speak to that. No. Okay, well, what else should we talk about next then, Sai? We can talk about our new code analysis features. So we've been working a lot on both static and dynamic analysis. So some of the new checkers we had, things like returning a local variable with std move,
Starting point is 00:39:31 something which I think Clang and GCC have both had warnings for for a while, like pessimization warnings. If you return a local variable with std move, then you're just preventing the copy from being elided um so we have a static analysis thing for that um also some bounds checking which is path sensitive now um so you know regular bounds checking which is not path sensitive my path sensitivity meaning i'm analyzing the control flow of your code and any conditions that would be required to enter a given basic block, essentially.
Starting point is 00:40:14 So if you have path insensitive bounds checking, then you get to some potentially bounded access, and you say, oh, it looks like there could potentially be an out-of-bounds access here. With the path-sensitive analysis, you also look at, okay, well, we got to this line by going through this condition, which means that actually you cannot have an out-of-bounds access here because you've already checked for it or something like that.
Starting point is 00:40:41 So it's basically preventing false positives. Yes, preventing false positives. Then a few other things like lifetime checking for coroutines. So coroutines, because you need to think about the lifetime of your coroutine frame and whether if you're referencing any objects in that coroutine frame, making sure that they're not going to be deallocated or anything. So we have some lifetime checking for that. Some use after move. Some support for GSL not null. I think that's most of the static analysis stuff. Then last year we talked a lot about address sanitizer, which we now have support for in
Starting point is 00:41:26 windows uh that's now out of experimental support so it's generally available both 32 and 64 32 64 release and debug okay cool and also the uh you no longer have to manually pass the correct runtime library um oh nice like it used to be that you know if you if you're building from i think it was if you're building from ms build it would be fine but if you're building uh on the command line or something like that you had to um work out which was the correct um address sanitizer runtime library and there were different ones for 32 and 64 and release and debug and just kind of a pain. So now you just have to pass fsanitize
Starting point is 00:42:08 address and the compiler driver works it all out for you. So you don't have to pass anything. And then also things like debugger integration for ASAN. So when you get say, I reparse access and ASAN
Starting point is 00:42:22 notices this and gives you the whole ASAN spew in your console. You also get a breakpoint at the location where it happened, as long as there's the relevant debug information. And it will say, like, we stopped here, you've got an ASAN exception, you can check at the console for more
Starting point is 00:42:40 details, but you know where you stopped, and you can look at the program state and everything that you might expect from post-mortem style debugging. Yeah, it's really nice. We never talk about the fact that Visual Studio supports ARM
Starting point is 00:42:56 and Windows, I believe, still has an official ARM build, right? Yeah. Does adress sanitizer work on the ARM targets? I cannot remember off the top of my head. I don't think it does yet. But also, no one get angry at me if I got that wrong. We also just got support for,
Starting point is 00:43:17 experimental support for libfuzzer as well. Oh, nice. So if you want to use libfuzzer to just chuck as much data at your APIs as possible to check for security holes and correctness holes, then you can use libfuzzer. I think it's fsanitize equals fuzzer. You pass.
Starting point is 00:43:38 There's some documentation on Microsoft Docs. That's easy to turn on just like the asan is. Yeah. Nice. That's effectively how it's supported on Clang and GCC as well. Is UBSAN in the pipeline then? We cannot promise anything yet. We're actively looking at what other sanitizers that we can support.
Starting point is 00:44:04 So yeah, I can't say for sure which ones will will get added or or when but yeah we're we're actively looking at um we're actively working on on additional sanitizers so okay so i have a question then excuse me about the static analysis that you just mentioned. Is these things that you execute by passing the slash analyze flag and executing the static analyzer, or are these things that are in the normal warning W3 set kind of thing? So there's a few different things. And there's a few different analyzers as well.
Starting point is 00:44:43 So there's the code linter, which is super fast stuff which will just be on by default and run and you get in touch and squiggles and things like that. Then the more heavy-duty checks are the slash analyze, but there are options to turn that on so you get those warnings directly in your your editor as well okay i feel like a few people are kind of aware of the the the separate this the slash analyze the static analyzer thing so if they're easier to enable Yeah. Yeah. Yeah, very cool. What else should we talk about?
Starting point is 00:45:28 I think, did we mention ABI compatibility with previous versions? Yeah, so that is, we are in 2022, in VS 2022, the tool chain is ABI compatible back to the 2015 toolset so if you have binary dependencies that were built with 2015 or 2017 or 2019 then they will be ABI compatible
Starting point is 00:45:56 with VS 2222, don't have to rebuild them we are also having binary compatibility with the C++ 20 switch. So if you build code
Starting point is 00:46:10 with VS 2022, both parts of it with the C++ 20 switch and parts of it without it, then those are going to be ABI compatible. And same going back to 2015. If you've got C++ 11 stuff which you compiled with 2015 then that will still be ABI compatible with 2022 stuff you compiled with
Starting point is 00:46:33 C++ 20. Wow yeah I know with 2019 there was the option to like install the 2015 or 2017 C++ build tools is that still available? Yes, yes, right in the installer. So if you want to upgrade to 2022, but you also need the old tool sets, then you can just install the old tool chain side-by-side directly from the installer and then switch between them. If you're using MSBuild, you can just switch between them in the project settings,
Starting point is 00:47:03 or you can do a similar kind of thing in CMake. At the top of the interview, you made some comment about there being different talks talking about, for the release, about changes made for game developers and stuff, too. Is there anything specific like that for various industries you would like to mention? Yeah, so I think on the side of game dev, I think the main things are um hot reload was
Starting point is 00:47:28 was one of the main things okay um we also did a lot of work on uh performance for intellisense for unreal engine uh we recently put out a blog post that intellisense is now will be ready you, like you get colorization and member lists and things like that if you're using Unreal Engine 18 times faster than it used to be. Oh wow.
Starting point is 00:47:56 Might notice that. Yeah, that one had, yeah, there were a lot of people who were like, oh, this is great, 18 times, and then there were people like, what were you doing before? Right, right. The basic idea is that it used to be that all of the translation units
Starting point is 00:48:15 would be handled completely separately. So, you know, we would do a ton of processing on these massive headers and things like that, and then duplicate that work for other translation units. So now that compilation state is shared between the files. So it only has to do that processing once and then shares that work. So it doesn't duplicate all of it per translation unit it's funny because you know i i recently did a c++ weekly and i comment on this from time to time like you know a performance
Starting point is 00:48:52 tip is to not repeat your work and uh people respond with you like well duh and no it's not necessarily always that easy right sometimes you have to recognize where the work is being repeated in the first place to even know that you can. And also like working out whether it is exactly repeated or very slightly different. You know, like if you think, okay, well, you know, I'm processing a file or I'm processing 10 files, right? These files all include the same set of headers therefore i can just process all of those headers exactly once right but maybe not you know like what if for some of those files there's some different um pre-processor defines or some other change in the environment which means that some of them get handled slightly differently than the others like identifying whether the work is exactly the same
Starting point is 00:49:53 or not and doing things completely correctly is is not trivial especially for something like c++ yeah yeah and he since you just mentioned ABI compatibility between different versions, like slash version flags in the same project or whatever. But if on one module you're compiling in C++20 mode, you're going to have different functions available to you on StdString than you would if you're compiling in C++17 mode. I can see that. There's also some things which are really subtle as well, like the no unique address attribute.
Starting point is 00:50:34 If you're compiling in an older standard version with an older toolchain, an older version of MSVC, it ignores that attribute because it's allowed to do that. The standard says that it can just ignore the no unique address. But then if you're compiling in C++20 mode, what happens if you then do actually care
Starting point is 00:50:57 about that attribute and you then compile your class in a way which is ABI incompatible with some other binary module, well, now you've just broken the one definition rule, essentially, and it's not obvious to anyone. So that's why for now,
Starting point is 00:51:17 the no unique address attribute doesn't do the same empty base optimization thing. You have to use an MSVC-specific attribute at the moment, which is not the ideal situation because ABI compatibility is something which really matters to a lot of customers. It's trying to make the best of a rough situation.
Starting point is 00:51:44 So if an ABI break happens trying to make the best of a rough situation. Right. So if an ABI break happens in the future at some point, then no unique address might go back to doing something. Yeah, yeah, yeah. So if we decided we haven't announced anything about what we would do with ABI for future versions, but say the next version of Visual Studio decided to break ABI compatibility, then that would be absolutely fine
Starting point is 00:52:06 and we could just do whatever we wanted because it's not going to be ABI compatible with the old ones anyway, so it's no problem. Right, right. We haven't mentioned VC package at all. We had Nicole Mazzucca on earlier this year and she was talking to us about some of the new enterprise features.
Starting point is 00:52:24 Any updates with that? Yeah, so I'm not sure what the state was when you had her on, but those are all out of experimental support now. So the main ones are manifests, versioning, registries, and binary caching. So those are
Starting point is 00:52:40 all generally available. You can use them all. I had a demo in my CppCon talk where I got binary caching working with GitHub Actions and GitHub Packages. You can
Starting point is 00:52:54 set up VC package and you can point it at your GitHub Packages instance and then whenever it builds your dependencies your dependencies then it will push those to github packages and then the next time that it does a ci run then if everything like all the flags and everything are the same then it will just pull those um those binaries or those packages straight down so it doesn't have to rebuild anything. So if you have large dependencies
Starting point is 00:53:26 you're using with vcpackage, like you have boost as a vcpackage dependency that you don't really want to be building boost every time you push a commit to your CI. So this is a good way to save a bunch of time and processing power. We also have a new website as well. I'm not sure if that was around this time.
Starting point is 00:53:45 A new website for ESCode or VCpackage? VCpackage, yeah. VCpackage.io so that has documentation and it also has a list of navigable, searchable list of packages. And you can also click on a package and it will tell you
Starting point is 00:54:02 what the features are for that package because some packages don't necessarily want all of the features. I think Boost is one of them. You don't necessarily want all of Boost or anything like that. There's optional features that you can
Starting point is 00:54:17 supply so the website tells you all about those and also the platforms which it's available on because some ports are not available on every supported platform. All right. I guess before we let you go, anything else we didn't cover? I know there was also maybe some VS Code stuff that changed recently maybe we should mention real quick.
Starting point is 00:54:38 Yeah, VS Code. I think one thing is GitHub Codespaces, which is having GitHub open. And I can't remember what button it is you press. I think it may be dot. You just hit a single button, and you can have a VS Code instance open in your browser to work on the project, which is pretty cool. Wait, magic. Does that work with C++ projects?
Starting point is 00:55:03 Yeah. Okay. Very cool. Does it just choose what extensions to bring in? Because I think you have a C++ extension or something, right? Yeah, so there's the C++ extension for Visual Studio Code. I think the VS Code spaces are all configurable, so you can decide what to install into them and things like that.
Starting point is 00:55:24 I haven't played around with that a whole lot. I should really do that. It does seem kind of cool, though. Okay. A few other things is support for cmakepresets.json. That's in both Visual Studio and Visual Studio Code. So that's like the... If you view cmake settings.json in Visual Studio,
Starting point is 00:55:44 that was specifying which toolset to use and any debug commands or things like that. This is the standardized version of that that any CMake tools can use. So Visual Studio and Visual Studio Code now have the same format for specifying these configurations. You can check this into your source control. You can use it directly from CMake. So if you specify minus minus preset, then you can say, if you're using CI or something like that, you can say, I want to build the Windows configuration for this or the Linux configuration or some subset of things or do whatever you want. It's just a nice way of specifying these things.
Starting point is 00:56:30 Some other things, IntelliSense support for CUDA. Oh, okay. That was added recently. A few things in preview, like the disassembly view for Visual Studio Code and make file tools. So we've got the CMakeTools extension, which was originally a community project and is now maintained by Microsoft.
Starting point is 00:56:54 So now we have a Makefile one as well, which is in preview. And then soon we will have integration for Client ID and creating definitions from declarations and vice versa. Just like the Visual Studio feature where you have a declaration in the header and right-click and say create definition, and it goes and creates a definition in your CPP file
Starting point is 00:57:18 so that you don't have to do it yourself. Sounds really powerful. Awesome. All right. Well, Sai, it was great having you on the show again today. Yeah, thanks very much for having me. Thanks for coming on. Thanks so much for listening in as we chat about C++.
Starting point is 00:57:31 We'd love to hear what you think of the podcast. Please let us know if we're discussing the stuff you're interested in, or if you have a suggestion for a topic, we'd love to hear about that too. You can email all your thoughts to feedback at cppcast.com. We'd also appreciate if you can like CppCast on Facebook and follow CppCast on Twitter. You can also follow me at Rob W. Irving and Jason at Lefticus on Twitter. We'd also like to thank all our patrons who help support the show through Patreon. If you'd like to support us on Patreon, you can do so at patreon.com slash cppcast.
Starting point is 00:58:02 And of course, you can find all that info and the show notes on the podcast website at cppcast.com slash cppcast. And of course, you can find all that info and the show notes on the podcast website at cppcast.com. Theme music for this episode is provided by podcastthemes.com.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.