CppCast - Pure Virtual C++

Episode Date: April 23, 2024

Sy Brand joins Phil and Timur. Sy talks about the imminent Pure Virtual C++ conference that they have been running with Microsoft's backing for a few years. Sy also discuss what they have been up to a...s Developer Advocate at Microsoft, as well as some fascinating outside interests. News C++ Foundation's C++ 2024 Developer survey results P3236R0: "Please reject P2786 and adopt P1144" P2786R5: "Trivial Relocatability For C++26" P1144R10: "std::is_trivially_relocatable" P1029R3: "move = bitcopies" (earlier alt paper) "C++20 modules and Boost: an analysis" "Boston C++ April 2024 online meetup" Links Sy's short films Pure Virtual C++ 2024 conference 'BF' written in DWARF debug info

Transcript
Discussion (0)
Starting point is 00:00:00 Episode 380 of CppCast with guest Sai Brand, recorded 12th of April 2024. In this episode, we talk about the C++ Foundation's Annual Developer Survey, Trivial Relocatability, and Modularizing Boost. Then, we are joined by Sai Brand. Sai talks to us about the C++ teamast, the first podcast for C++ developers by C++ developers. I'm your host, Timo Dummler, joined by my co-host, Phil Nash. Phil, how are you doing today? Oh, I'm all right, Timo. How are you doing? I'm not too bad, thanks. I'm getting ready to actually fly to the UK in a few days to attend ACCU. I'm looking forward to seeing you in person there.
Starting point is 00:01:11 What are you up to, Phil? Well, I am frantically preparing for ACCU. As you know, I've taken over running it this year, so unbelievable amount of last minute preparation to do, but it's coming together. So I hope to have some time to see you there so speaking of uh you know you organizing conferences and all that i heard you're you actually had a major career change recently do you want to talk to us about that yeah well uh turns out since we last recorded i have left sonar so i'm now focusing fully on conferences training uh that sort of thing
Starting point is 00:01:46 consultancy as well it occurred to me there was a funny thing for both of us the um you and i team we worked at jet brains previously and when we left we actually said on this show what was wrong with jet brains why did we leave and then felt that we had to explain why why we left that there was actually nothing wrong. It was just time to move on to something new. And it's the same thing again here. Nothing wrong with Sonar. Still a great technology company.
Starting point is 00:02:12 Still endorse their tools. But yeah, I've not actually left for a different job. I'm going to be fully independent. So if any of our listeners need training in C++ or TDD, do let me know. I need the work. All right. New work. All right. New chapter.
Starting point is 00:02:28 All right, Phil. So that's really exciting news. I wish you good luck with your now independent career. And I'm looking forward to all the conferences that you're going to be steering and all the trainings I'm probably not going to attend, but I wish you good luck with that. And I've been to one of your trainings and I know that they're great. So, so.
Starting point is 00:02:48 Okay. Well, there's an endorsement. All right. So at the top of every episode, we'd like to read a piece of feedback. This time the feedback comes from our last guest, Eric Keen, who posted on Reddit after he was on the show.
Starting point is 00:03:00 Hey all, first time doing a podcast and Timur and Phil created a great experience for it. I hope everyone enjoys and got some visibility into the standardization process. Well, thank you very much, Eric, for your feedback. I'm very happy you had a good time. We try to treat our guests well. So we'd like to hear your thoughts about the show. You can always reach out to us on xmastered on LinkedIn or email us at feedback at cppcast.com. Joining us today is Cy Brand. Cy Brand is Microsoft's C++ developer advocate.
Starting point is 00:03:29 Their background is in compilers and debuggers for embedded accelerators, but they're also interested in generic library design, meta programming, functional style C++, undefined behavior, and making our communities more welcoming and inclusive. Outside of C++, they make short films and write poetry. Sai, welcome to the show. Hey, thanks for having me. Right, so usually Phil asks you a question about your bio, but this time I just want to run a...
Starting point is 00:03:54 I really want to be the one asking this question. Like, it's just such a burning question. Okay, thank you, Phil. So back then, in the days when X was still Twitter, I was actually following you there quite actively, and you had the best advice for weird movies to watch. So thank you very much for that. That was great.
Starting point is 00:04:13 But now you're actually making your own films? Yeah. That's super cool. How do you make films as a hobby? What does that look like? I'm pretty curious. I'm just a massive fan of independent cinema, so I'm just very very very curious about that yes i got very into um like experimental short films like
Starting point is 00:04:31 non-narrative films where it's not so much about telling a story or having characters but more about in evoking a certain kind of feeling or emotions or ideas so um i make experimental films um set a lot in nature and filled with you know the sea and gestures and and small moments that i find beautiful um so i just want to try and make films which capture a certain moment or feeling uh and they're usually fairly short uh but i did one which was a bunch of like micro fictions set to to scenes and i co-create all of my my films as well um but they're really fun to work on and it's great to have some creative outlet that's not just coding yeah that is really cool is there any way we can check this out or is it all just yeah they're they're all on on vimeo um i'll send you the link so you can
Starting point is 00:05:30 stick in the show notes that's so cool right so we will get into your bio um in just a few minutes but first we have a couple of news articles to talk about so feel free to comment on any of these the first one is the C++ Foundation runs every year a C++ developer survey. The results for this year are out. And I kind of looked at it and I thought there's quite a lot of interesting stuff in there.
Starting point is 00:05:55 So I don't know if you had a chance to check it out, but there were quite a few things that kind of stood out to me. So for example, there's been a lot of talk, you know, about safety and security in c++ but i looked at there was a category in there what is the most frustrating thing for you when you work with c++ or something like that and at the top are all of the tooling issues like lack of a standard build system and package manager and build times and all that stuff and
Starting point is 00:06:21 memory safety is like i think the first like item that actually has stuff. And memory safety is like, I think the first like item that actually has to do with memory safety is like it appears at like number nine or something. So it's really quite a lot further down the list. So I thought on the one hand, that's maybe surprising. On the other hand, maybe it's not. Any thoughts about that?
Starting point is 00:06:40 Well, I think we've got memory safety pretty much under control in C++. That was a joke, right? Well, compared to C. Right. So it doesn't seem to be the most burning issue on, like, practicing developers' minds, despite all the noise that, you know, has been going on.
Starting point is 00:06:59 I also found it interesting that CMake is now more and more, like, the dominant build system. So we kind of do almost have a de facto standard there. CSS 11 is still the most popular standard. It's ahead of CSS 14, which is ahead of CSS 98, which is ahead of CSS 17. But yeah, CSS 11 is the most common one. I found that surprising.
Starting point is 00:07:23 There was also a question, how many of the following C++20 features do you plan to start using within the next 12 months? Only about 30% say they plan to start using coroutines and modules, even though it's been how many years since you standardized them? So that's interesting. Yeah, well, coroutines maybe, but modules, they were standardized in C maybe but um but modules they were standardized
Starting point is 00:07:46 in c++ 20 but are they ready yet yeah we're gonna we have a new another news item about that uh in a bit um i think even for coroutines like um what was shipped in c++ 20 was like support for writing coroutines rather than like using coroutines in regular application code um and they're they're still getting like rolled out standard over standard so i think that kind of explains the the lag there oh yeah yeah but you could use them at least yeah for sure so concepts are actually a bit more popular in this in this category so i found that interesting there's more people who are apparently looking into conceptualizing their libraries now uh there was a section about what's your most commonly used ide microsoft is the market leader there which is studios and number one which is studio code is
Starting point is 00:08:36 on number two thanks for saying yes yeah uh c line is actually very closely behind uh vs code on number three and then i think you got vim and stuff yeah i'm actually going to take personal responsibility for all of that right uh oh one one thing that i found a little bit surprising is uh which is a primary compiler and gcc came out on top yeah um and clang was third i think and clang was third so gcc then microsoft then clang and even more surprising a third of people like 33 or something said that they don't use either of the three major compilers as their primary compiler that i i thought was a bit surprising so there's actually more i guess a lot of embedded people who use custom compilers, but there's a lot more of them out there than you would think
Starting point is 00:09:28 if you're just in this bubble of the major compilers and this committee stuff. I think they're kind of a bit overrepresented sometimes, perhaps. Yeah, I found a couple of interesting points. One was, I think, a new option in the pain points question this year was a unicode and internationalization and it wasn't hugely listed as a pain point among people but I think it's interesting to look at that because you know unicode support and standard c++ is I would say lacking to say the least so it would would be interesting to see how that develops
Starting point is 00:10:08 and if we can get better stuff in the standard off the back of that. Like I just saw a meme on, you know, one of the like Twitter or Blue Sky or Mastodon, I can't even remember now, which was like on the left-hand side was all of the Rust options for strings and there's like 15 of them or something. On the left-hand side was all of the Rust options for strings, and there's like 15 of them or something. And then on the right-hand side, there's C's options for strings, which is char star.
Starting point is 00:10:35 And there are a bunch of people arguing, oh, C's simplicity is the right way to go here, or Rust is actually doing this right because they're not pretending that strings are simple. It's interesting because C++ is kind of in the middle, closer to the C side where we have more types, but it does not really represent the reality of what text encodings are like. Yeah, there's W-chan is called T and stuff like that.
Starting point is 00:11:04 Yeah. Right. things are like yeah there's w char and it's called t and stuff like that yeah right i also noticed um the vc package and conan were about like 20 percent of respondents uh but almost half of the respondents said that dependency management was a major pain point which was kind of interesting to me right so the next news item for today is something that's going on in the css committee right now there is this feature called trivial relocatability which you know people have been trying to get into the standard for quite a few years now people have worked on for quite a few years now and And there are now actually two competing proposals. One is P2786 by a bunch of people from Bloomberg. I think Mungo Gill and Alistair Meridith, if I remember correctly. That sounds right.
Starting point is 00:11:54 And another one, P1144, which has been around for quite a lot longer from Arthur O'Dwyer. And there's some kind of controversy going on right now. There's like long discussions on the committee which i i haven't followed because i'm not really on the library side of things and i think right now it's in library evolution but there were lots of emails that i kind of have not really read because i didn't have the time on the on the committee mailing list uh yeah there's
Starting point is 00:12:18 some kind of debate going on there is actually a paper now which is going to be in the mailing that's going to come out in a few days you're going to put the link into the show notes uh there's a paper signed by over a dozen people i think are representing a lot of major libraries like boost and qt and others to reject b2786 like that's the bloomberg version and to adopt p1144 because the former is unfit for purpose for all of these reasons which which that paper discusses. So yeah, there's something brewing there, which I thought was newsworthy. Yeah, what struck me about this was that, well, first of all, it's not the first time there's been a contender to P1144. Years ago, there was P1029, I believe no douglas uh he actually proposed that not as a necessarily a competitor
Starting point is 00:13:08 but just to say well we don't get p 1144 in time then that at least this one gives us what we need for he was building his error handling stuff on top of that which was uh also potentially part of um the you know herpes utters static exceptions. That all seems to have died off a bit. So I think that's why NALA hasn't really pursued that. But really, the amount of interest in this, like people signing a paper to say reject one proposal in favor of another, doesn't really happen. It's a really big, important feature.
Starting point is 00:13:39 But most people are not actually aware of this at all. So it's worth talking about here that this is a feature which could actually offer a lot of behind the scenes, perhaps optimization capabilities, but really important optimization capabilities because it's all about types that can be moved from one location to another, just simply by bit copying them.
Starting point is 00:14:00 And there's no way to express that in the language at the moment such that compilers can you know be guaranteed to optimize around it so what's the difference between that and trivial copyable which is you know you can just copy it around using memcopy in theory really it's just about the um uh the destruction part because the or the you know putting into a mood from state what does actually mean copyability that's that's copying the bits movability it's the same thing but now you've got to do something with the um with the old site so it would seem to be such a simple thing yeah yeah and we've had at
Starting point is 00:14:35 least three proposals in this area and i think p1144 is on r10 now yeah it's been around for a while i remember the first time i came across it i think it was c++ now conference 2019 i think when uh i had a chat with arthur about this and he explained to me like the idea and the proposal which has already been around at the time yeah yeah um and like the way he explained it to me is uh you have a, you know, a type that's not copyable, just movable, like unique pointer, right? But like whenever, like it doesn't have any references to like, how did it go? Okay. So whenever it doesn't have any internal pointers to itself,
Starting point is 00:15:16 basically, right? That's right. Like you can just like no values inside the object depend on where the object itself is in memory, right? And whenever that's the case, you can just, yeah values inside the object depend on where the object itself is in memory, right? And whenever that's the case, you can just mem move them. And apparently for things like unique pointer, that's a massive opportunity for optimization.
Starting point is 00:15:36 Yeah, especially like if you have a vector which has to grow, then you have to like take all of the old elements and move them on to to the new memory and if you can do that just by blitting everything across then that can be a massive performance gain yeah yeah i think i haven't looked at the the latest version of d1144 but i know in the past the sticking point was about really amounted to a destructive move and that's always been a bit problematic getting uh getting pinned down in the past the sticking point was about really amounted to a destructive move and that's always been a bit problematic
Starting point is 00:16:05 getting pinned down in the committee. So hopefully it's going to make it at some point. So destructive move, is that the thing where, like Rust has that, right? Where if you move out of an object, like it's basically gone and like the static, like the compiler prevents you from using that object. Whereas in C++ it's this weird kind of half alive, half dead,
Starting point is 00:16:27 moved from state that might or might not explode if you touch it. Yeah. So how could you do something like this in C++? You don't have this level of static analysis that Rust does where it just doesn't let you do that, right? I know there's been papers on it for years, and this one sort of touches on it but doesn't completely try to solve it i don't know the details oh yeah maybe we should drill down
Starting point is 00:16:51 into this a bit more in the future it seems like a interesting topic yeah yeah all right i got one more news item uh which was a blog post by uh ruben perez um called c++20 Modules and Boost which talks about what would it take to modularize Boost given the support that we have today for modules. There's a long blog post and the conclusion is
Starting point is 00:17:19 it's too early. We could do something but probably not many people would use that in production so it's too early like we could do something but like probably not many people would use that in production so it's probably not worth it also modules may provide some compilation speed up but they're not gonna just magically solve all the issues particular instantiate template instantiation time is a big pain point for boost right they have a lot of templates which is not affected by modules at all. And he concludes saying, yeah, if you're writing a library today and you're not making it module-friendly, then that's probably fine.
Starting point is 00:17:55 He talks a little bit about providing potentially modular bindings for some Boost libraries, as opposed to modularizing the library itself, which might be interesting to get some early adopters, but it's too early to actually move the libraries to modules in any meaningful way. So I thought that was interesting, coming from a Boost author. Yeah, I think it's still going to be the std module
Starting point is 00:18:17 in C++23 that really gets us moving. I seem to remember MSVC has good module support. Si, is that something you know much about? Yeah, we ship the standard library modules now, and Office has been moving towards header units, and that's actually going to be one of the talks at Pure Virtual C++, which we'll talk about in a bit, is a report on how progress has been going on moving Office
Starting point is 00:18:48 towards header units and what kind of speedups we've seen, what the benefits have been, what the pain points have been. So yeah, please do tune into that if you want to hear more. Yeah, that does sound like a useful case study, actually. Yeah, because it's like a massive code base and has been around for such a long time that these are the kinds of code bases which if we're going to have wide use of modules,
Starting point is 00:19:18 these are the kinds of code bases we have to migrate over to modules and header units. It'd be funny if Office gets modules before Boost. So I'll take that. There's one more news item that I wanted to bring up. So we did have an email from one of our listeners wanting to announce their next meetup. Now we don't usually just announce individual meetup talks.
Starting point is 00:19:40 We love to announce the launch of new meetups, but obviously we can't scale to announcing every single meetup around the world, their next meetup talks. You know, we love to announce the launch of new meetups, but obviously we can't scale to announcing every single meetup around the world, the next meetup. But this one did strike me as a little bit different because it's, well, first of all, it's the Boston C++ meetup. But their next one, the end of April, is going to be online. And many meetups went online during the pandemic. And then, of course, when we came back out of the pandemic, they were gone back in person.
Starting point is 00:20:08 So there's very few of these left. But it does mean that you don't have to be in Boston or anywhere near it to attend. So I think it's just worth mentioning on the show. If other people still are running online meetups, let us know. We can mention them here at least once so um that's actually probably a good segue into today's interview because uh sybrand is joining us here to talk about pure virtual c++ and online conference so sy before we um get into our main questions and don't want to tell us about the conference itself what is pure virtual sure so this is something which we've been running for a
Starting point is 00:20:45 few years now uh i started off the the first year of the pandemic where i was like hey you know all of the the conferences are getting cancelled there's nothing going on why don't we run uh an online only event and maybe we can do it in like a few months time you know because we've we've never done anything like this before i don't know what i'm doing and my manager's manager was like cool can we do it in like three weeks i was like uh maybe so i like pulled it all together and ran the entire thing off of my laptop and we had some technical difficulties but it went okay uh and we've been doing it every year since so this year it's going to be on the 30th of april and we're going to have five sessions on the day uh we're going to have ben dean is going to be our guest speaker
Starting point is 00:21:39 talking about message handling with boolean implication kind of a Boolean algebra applied to C++ kind of talk. Keith Stockdale from Rare is going to talk about automated testing of shader code, which would be interesting for anyone working with OpenGL and the like. I'm going to talk about how I embedded a programming language in Linux debug information. That's hilarious. Let's talk about that a bit more in a bit. Yeah. Sina McKenzie is going to talk about C++ development with Copilot Chat.
Starting point is 00:22:17 And then Zachary Henkel from Office is talking about adopting header units in the Word code base. So you said it's an online conference. How can our listeners participate? Where do you sign up? Is it for free? Does it cost money? Yeah, it's a one-day conference, all online, all free, for anyone who wants to join.
Starting point is 00:22:44 Not just if you're interested in microsoft stuff you know these are topics applicable to anyone doing c++ and uh i'll give you the link that you can put in the in the show notes but you just register and you'll get an email with all the details uh we'll be streaming out to a bunch of locations um on youtube and twitch there'll be live chat so you can uh ask all of the presenters questions, all the kinds of things which you might expect. So you say you threw the first one together in three weeks. As someone that's run online conferences before,
Starting point is 00:23:17 that sounds pretty crazy. How did you manage to pull that off? I just had a lot of stress and worked too hard for three weeks. But, you know, I learned a lot. You still read more. Yeah. Well, it got easier in subsequent years because I could say, hey, look, we did this thing and it worked out.
Starting point is 00:23:39 We got a bunch of people. Maybe we can get some help from production folks and in microsoft because you know we've got folks who produce events and uh and do live recordings and all of this stuff so we have the technology and we have the people it's just a case of of getting everything into a row so uh it's a lot easier for me now i can delegate some of the tasks rather than doing everything myself but it did mean that i learned like a lot about you know producing digital events and streaming and uh you know i was trying to set up q a sessions so i would like call the speaker on skype and then i had obs recording like the virtual webcam devices and rerouting my audio around and uh it was a lot of fun yeah yeah i mean we both phil and i both
Starting point is 00:24:36 have experience organizing conferences including online conferences but doing it in three weeks in these conditions that's like another level level. Yeah. I'm very impressed. I've never done anything like that. Yeah. So that's quite impressive. I'm so happy to hear that it's going strong. Yeah, I think we get pressure every now and again. Oh, should we make it an in-person thing?
Starting point is 00:25:01 But I think having a free event online that people can, can come along to, it serves a different purpose. You know, if you want the, the in-person conference where you can go and chat to all of the speakers and the other attendees and network more and, and things like that, then there's a bunch of conferences out there for you already. And they've pretty much all of them, I think, have started up again and are going strong. So if you want that kind of thing, go to those conferences. And if you want a low-effort thing,
Starting point is 00:25:36 you can just click a link and go and watch a bunch of talks about C++ live and chat to everyone and not have to pay anything then this serves you well so i think that there is there's a space for both kinds of of these events absolutely in the the c++ community yeah plus you have to keep it running because pure virtuals can never be final do you just come up with that or have you been planning this? It's a classic Phil. I've been planning for at least 20 seconds now.
Starting point is 00:26:09 Just keep them going. Keep them coming. I was pretty pleased with the name of the conference when I came up with it. I presume you came up with the name. Yeah. Right. So you have a session at that conference yourself and you said it's about embedding a programming language interpreter inside debug information. What?
Starting point is 00:26:30 Can you talk about that a bit more? Yeah, right. So there's a bunch of background you need to understand what's going on here. So it's specific to Linux. So in Linux, you have your executable program, which lives in what's called an ELF file. That's the object file format on Linux. And now your debugger needs to be able to take the machine code
Starting point is 00:26:57 and that binary and kind of link it back to the original source code that produced it. Because if you want to set a breakpoint on a given line of some source file, then you need to know to which machine instruction that line of source code corresponds. So in order to do that, you need what's called debug information. And debug information encodes a bunch of different things
Starting point is 00:27:23 which do that mapping between source and binary, like where the source code lines match up to, where you can find the source code functions in the final binary, how to unwind the stack, and then where variables are so i was implementing a dwarf parser for something completely unrelated to anything and it is a lot more complicated than i expected it to be you know i wrote an elf parser in like you know an afternoon it's super simple and the dwarf parser is taking me months because it's this behemoth. It has three different bytecode interpreters that you need to write in order to parse this format, which is just absurd to me. It's about three more bytecode interpreters
Starting point is 00:28:16 than I would expect to be in a debug information format. Is that something specific to Dwarf? Or is it something in complexity that's kind of inherent to just storing debug information, which you can kind of do on every major platform right yeah so the the the bytecode interpreters that are in dwarf there's uh there's one for expressing the line table information and that is essentially because line tables get huge very fast you know if you want to map every line of your source code to a machine instruction then you're going to need a table an entry in your line table for every single line of your source code which could be millions millions of entries and each of those is going to have a file name and a column and a line number and a
Starting point is 00:29:08 machine instruction that corresponds to, and it has a bunch of flags to tell you if it's part of the function prologue and things like that. So this data gets very big, very, very fast. So they came up with a kind of binary encoding scheme, which lets you build this table up bit by bit, because mostly these things are, the entries in these things don't change much. You know, each line of source code is going to advance by one or two or three lines or something.
Starting point is 00:29:37 And then each machine instruction is going to advance by a few bytes. So you don't really need to store the entire table you just need to store how you would build up this table so it's like a space saving mechanism so it's like a shader but for like like instructions instead of like colors or whatever interesting yeah it's just a it's a fairly simple um bytecode but uh i did not expect to have to write bytecode interpreter for that and then there's a separate one that you need to write for uh the stack unwinding information because similarly that is just a massive table which
Starting point is 00:30:19 gets very very large because each entry in your stack unwinding information is essentially like okay at this memory address you restore all of these registers in your system by uh reading this register or finding the top of the stack and then offsetting it by this amount and reading the the value there and there's a bunch of different options you can have. And again, this table gets very, very big, very, very quickly. So they have a scheme of encoding this in a very memory efficient manner. But then the interesting one to me was how addresses are encoded. So while your code is running, you might want to print out the value of a variable, right? If you're in a debugger, it's like one of the most common things you want to do.
Starting point is 00:31:09 So dwarf information encodes the locations of variables. And these can get kind of complicated because it might just be, oh, read register R12, or it could be read this memory address location. But it might be, okay, read this register, dereference the pointer, which is stored there, and then add this offset onto that value in order to find the variable because, you know, these things can move around and often programs will be compiled with a base pointer these days so it can be kind of tough to locate variables so they have a again another like bytecode for doing address calculations and i was implementing this thing and it's this is more complex than the the line table and an unwinding bytecodes this actually has has a stack of memory which it runs on,
Starting point is 00:32:08 and then it has operations to push some address to the top of the stack. Oh, okay, I see where this is going. I see where this is going. Or swap the top two values of the stack. And then it also has instructions for like oh um jump ahead this many bytes in this is called a dwarf expression uh so you can jump forward a number of bytes and it even has a way to do that conditionally so it's like hey this thing looks like suspiciously Turing complete I wonder if I could implement like a programming language inside this spoiler alert you can it just takes a lot of work
Starting point is 00:32:46 i didn't have enough work to do already yeah so i i went and i was like maybe i can implement a a programming language interpreter for one of my my favorite languages which uh we'll call bf for a family friendly podcast uh if you're you might be familiar with it it's essentially has eight instructions it runs on an infinite tape of cells which go from zero to 255 and has a pointer which points to the current cell so there's instructions for moving the pointer left or right instructions for incrementing and decrementing what's at the pointer, and it also has loops.
Starting point is 00:33:29 So you can surround these instructions with square brackets, and then the program will loop doing everything between those brackets while whatever the pointer is pointing at is greater than zero. Now you can embed basically an arbitrary program written in this language we shall not name
Starting point is 00:33:49 and embed that in your debug file, and that's going to execute that? Yeah, so how I did it was I wrote an interpreter for BF as a dwarf expression. In order to do that, I had to write, I had to first write an assembler for dwarf expressions because I didn't want to write this in binary by hand. So I wrote an assembler for dwarf expressions
Starting point is 00:34:15 with full support for jump targets and labels and all of this nonsense. And then I embed the interpreter in the dwarf information as the location information for some variable. And then I store the actual BF program in some location which that variable points at. So then when you load up GDB or some debugger and you just break at the start of the program and then say hey
Starting point is 00:34:49 what's the address of this variable then it runs the interpreter right uh so then you could implement okay interesting so you could you could write a program and embed it in this file and then it's got to run in. Yeah, so it's run by the debugger. The debugger interprets the dwarf expression, which I have implemented an interpreter in. Okay, so here's an idea. Why don't you write like cod-based game of life in BF
Starting point is 00:35:23 and let that run in there? And that is in itself also Turing complete. So you get another level. Theoretically possible, yeah. Or you could implement a dwarf parser. Yeah, I guess you can. So basically you trolled a dwarf. Yeah, I trolled a dwarf.
Starting point is 00:35:43 Right, so that's fascinating i think i you definitely sold me i need to be at this conference um um so uh let's talk maybe about something a little bit different so uh you work at microsoft and uh we actually had a few uh quite a few uh tooling related episodes uh over the last year. We had Sea Lion, Conan, Compiler Explorer. We had one on Soda, like one or two others. We have kind of neglected Microsoft
Starting point is 00:36:11 a little bit in the last couple of years. Not deliberately. Not deliberately at all. It's just, I think both Phil and I just are not regular users of Visual Studio. So maybe kind of, there's a little bit of maybe
Starting point is 00:36:24 implicit kind of bias there of like this is not the tool we use every day but a lot of people do like it is literally the most popular ide on the market so we felt like yeah it's high time to like invite you over and let's talk about what the microsoft super sauce team has been doing so you've been on the show the last time actually in november 2021 yeah so uh it's been a while um i think you've been on the show the last time, actually, in November 2021. Yep. So it's been a while. I think you've been doing a lot of stuff that's really, really good over there at Microsoft. Do you want to talk about that a little bit? Sure.
Starting point is 00:36:54 So maybe I can give you a kind of overview of our main areas we've been working in, and you can let me know if there are any ones you're particularly interested in. So the kind of main topics are cross-platform development, productivity in the IDE, game development, build insights, which is a tool for working out where your bottlenecks are in your build system, the performance of the IDE itself, of course, our tool chain vc package or package manager and then all of the vs code extensions which we have so maybe i can
Starting point is 00:37:33 tell you some of the the most interesting things i think we've been working on yeah yeah one's the cmake debugger so if you've ever had ridiculously complex CMake programs, which they are, you know, CMake scripts are programs. Yeah, that's any CMake program. Sometimes these things are difficult to debug working out
Starting point is 00:37:58 what the value of... Yeah, it's also things that really shouldn't exist but you kind of need them. I think we covered on our news section both when CLion came out with the CMake debugger and when Visual Studio came out with the CMake debugger. I think we kind of covered a lot of the stuff individually in the news section, but it's just kind of great
Starting point is 00:38:18 to have this kind of overview to actually have you here talk about this stuff. Yeah, so the CMake debugger makes it a lot easier than just doing kind of printf debugging which is what i tend to do when i have problems with my cmake and we upstreamed all of that work into uh into upstream cmake so everyone else can use it as well that's amazing and uh so we have wsl support and the ide and have had for a while so you can just automatically target uh any wsl installations you have and you don't have to like set up a an ssh connection or anything like that wsl1 and 2 wsl1 and 2 yes uh where wsl for those who don't know is windows
Starting point is 00:39:02 subsystem for linux yeah that i found actually quite quite useful on the occasions where i do have to you know drop to windows and check that something compiles with windows or do other stuff there like that's a feature that i found very very useful yeah um i've been using it for like all of the dwarf nonsense which i did uh i did all of that from visual studio just with wsl support but we recently added like an automatic wsl installation feature to visual studio so if you just want to get up and running with wsl and you don't really care about what distribution you're installing or going through all the setup instructions you can just hit install wsl for me and it will check all of the the system requirements it will download everything it will get everything set up and then you can just jump straight into a linux environment
Starting point is 00:39:58 on your windows machine and run programs there from visual studio. Great. You've done a lot of work on Unreal support as well, right? I mean, that's another huge ecosystem. Yeah. So Unreal Engine has been one of our major focuses in the last year. Like in the last year alone, we've supported Blueprint references, which Blueprints are a major feature in Unreal Engine.
Starting point is 00:40:24 So being able to see which blueprints reference each other and kind of visualize those is really handy from Visual Studio. We've added a log viewer, so you can see the Unreal Engine log directly in the IDE. We've added better HLSL support. There has always been a really good hlsl extension uh for visual studio but now that's shipping inbox so you don't have to to install it separately then smaller things like macro formatting naming convention checkers uh code snippets specific to unreal
Starting point is 00:41:00 engine uh and also a test adapter for Unreal Engine. So those are a bunch of the things we worked on just in the last year. Definitely taking that seriously. Yeah, it's one of our major user bases. Like a lot of people who are targeting Unreal Engine are using Visual Studio. So we want to make it the best environment we can for those people. Do you have anything to do with the compiler people as well? Yeah, well, I don't work on the compiler stuff,
Starting point is 00:41:34 but I have to keep track of everything for things like release notes and whatnot. So we have been doing a bunch of toolchain work, like implanting the the last optional c11 features um like c11 atomics and threads were both uh optional features which we haven't had support for um but now do um of course the standard library modules is something which has needed a lot of work both in the compiler and build system and the standard library modules is something which has needed a lot of work, both in the compiler and build system and the standard library to support. We've had one of the most interesting things, I think, from the language and library side is we produced extensive documentation
Starting point is 00:42:21 for C++ 20 and 23 ranges. So that's all on on microsoft learn so one of the the things that i found when i was doing a lot of ranges work was you don't always just want to see oh here's all the the different types which are available and here's all of the different functions which they have defined on them and the bunch of different constructor overloads and dot begin and dot end and things like that what you want to know when you uh when you use a range are things like when is this going to be a sized range like what can i call size on it and get the size back in
Starting point is 00:42:59 in constant time when is it going to be a common range which is when the the begin and end iterators return the same type so you can pass it to like a uh a standard c++ algorithm like a classical c++ algorithm uh all of this stuff can i iterate over this thing when it's cons um these are all the questions you're wanting to know rather than just what does the API look like so with all that in mind we produced documentation for the entire ranges library which answers exactly those questions the things you need to know when you're using a range uh kind of have them just in a window of my uh my documentation which tells me everything i need to know and and we have that now i'm really happy with with how that works that that is really cool a range of information there
Starting point is 00:43:54 so so one thing that i've kind of also noticed i mean over the last few years that i think when i started kind of getting involved in standardization stuff like it was always that microsoft were kind of lagging behind and like usually clang was like the first compiler to implement any new stuff and then maybe gcc and then microsoft would be like yeah whatever like five years later maybe they have an implementation as well like constexpr for example or other things yeah but it's kind of really flipped the last few years. I've been really impressed by this. Now, a lot of the time,
Starting point is 00:44:30 Microsoft is the first compiler that supports something. And then the other compilers are lagging behind. And remember, I noticed this when it was two years ago where I did a CppCon keynote about new C++3 features, and I was toying around with deducing this, which is one
Starting point is 00:44:48 of the kind of new language features in C++23. And that was two years ago. And the only compiler at the time that already supported it, even though like the standard wasn't even out yet, was like Microsoft, right? And I think Clang now supports it as of, I think, two episodes ago. We had a news article that now Clang supports it as well, like two years later. So you're doing good stuff over there. I'm a big fan.
Starting point is 00:45:13 Introducing this especially was happy because I worked on the paper for that. So it was really great to be able to play around with it and just download a production compiler and play around with this feature that I helped work on so so those those few weeks i was actually quite heavily using windows and like visual studio because that was literally the only compiler that where i could compile the code i was supposed to show so that was really cool yeah i think for the the standard library especially because we open sourced the standard library seven years, several years ago, and, um, have been
Starting point is 00:45:45 getting tons of community contributions. Um, like people will just go ahead and implement some massive new C++ 23 feature or something and send us a PR. Uh, and it's, it's wonderful. It's really become a community-driven project, which is great to see. So you mentioned some standard papers that you've worked on before.
Starting point is 00:46:12 Do you have anything in the pipeline at the moment? Not at the moment. I worked on three papers, which went into C++23. Deducing this was one of them. The monadic extensions to stdoptional. Oh, that was like a last minute thing, right? They made it i was very happy about that one it was like i know i think i'd worked on it for so long and it just like lagged and then i finally managed to get it in in fact
Starting point is 00:46:38 i remember i think phil you were there in like uh library evolution working group for 2017 i think maybe yeah that was like the first time that i presented that paper and i remember having you in the room for that and being able to say like yes this is something that we want was was very helpful it's always great when you have someone on your side in these meetings glad to help and you said there was a third thing the third one was the Cartesian product ranges view which I did the initial paper for and then
Starting point is 00:47:13 lost steam when it starts to get into the endless uphill push that is getting something into the standards from from um from nvidia pushed through the the last of it which i'm very grateful for yeah there's often that point where the paper's basically complete everyone agrees this is what the direction we want to go in
Starting point is 00:47:39 now we just have to wait 10 years to get in. Yeah. Yeah, Cartesian product is one of these things which, I mean, it's like that with everything in C++, right? It seems kind of simple, but there's a lot of complexity for it. A Cartesian product, especially, except Cartesian product review for people who don't know, is basically like a nested for loop, right? Say if you have a courtesy teasing product with three dimensions then you loop over the the first dimension and then the second dimension and the third dimension but there's there's some interesting properties that fall out of that such as the uh all of the
Starting point is 00:48:20 dimensions past the first one you have to um to iterate over multiple times but the first dimension you only iterate over once so does that mean that you can constrain cartesian products such that you can use an input range as its first argument and you can use forward ranges as subsequent arguments uh so these are the kinds of questions which you have to answer and there's no like obvious right answer right because maybe you say oh well for for simplicity and for for symmetry then we should just say oh everything has to be a forward range because then it it doesn't really matter as long as everything is a forward range then then it compiles and it's all good but then you say oh well maybe there's like a an edge case where you want to pass like a i don't know an i stream range or something is the first argument of this thing and because it's technically possible why should
Starting point is 00:49:14 we disallow it and and all of that so you you really get into the reads with some of these these design points yeah i mean i think that happens in all of these papers like yeah exactly we have that going on in the contract study group all the time. Like right now, for example, we are stuck on this question. Like if you have a assertion and you have a predicate and like, do you guarantee that it's evaluated exactly once or at most ones,
Starting point is 00:49:39 you know, that's great because then it's kind of backwards compatible with macro assert, but then you can't do kind of caller side or callee side checking. And if you link that together, like it might be evaluated twice. So you might want to allow that. Otherwise, like you have to break ABI to make that work and you have this like impossible trade-off, right? So which one do you choose? So I have like a paper in the mailing, like listing all the options, but like, it feels like every one of those things is like, okay, we could do this or we could do this and like neither is right or wrong but like these are
Starting point is 00:50:08 the trade-offs and then you always have the camp of people who are like i want this because this is my use case but i want that because that's my use case and yeah how you decide and like that's when it takes 10 years it's like there's always it's like some kind of a property of standardization that these things come up i don't know it's funny um but i actually okay i have another question for you so i actually have an observation so if we had recorded this episode a year ago all three of us would have been developer advocates at the time because i was developer advocate for um for like the c++ stuff at jetbrains uh you are obviously still the developer advocate for C++ stuff at Microsoft. And Phil was developer advocate at Sonar until I think last week.
Starting point is 00:50:52 But yeah, now Phil and I both have moved on. You are still hanging in there. But do you want to just tell our audience again, what actually is a developer advocate and what do they do? Yeah, I mean, I thought it was funny when i saw that in the the prep notes for for this episode because like well i could just ask you to like no it's curious because maybe maybe we have different interpretations i mean i think we probably do but yeah i i think like for me a developer advocate is just wearing as many hats as humanly possible really uh so like i did some feature design work like i worked on the the structured diagnostics um feature for visual studio which we have like um your compiler errors
Starting point is 00:51:35 can go through sarif information now which is like a structured um way of of um writing diagnostics and then that can be visualized in like a hierarchical manner inside the ide so i worked on that feature um conference stuff of course like organizing pure virtual c++ uh designing demos for other talks reviewing abstracts uh dealing with like suggestion tickets for for visual studio uh editing the c++ blog we have doing video content release notes uh a bit of standards committee work like we talked about uh did a bit of open source work like i implemented the monadic extensions for std expected and the um and microsoft stl and some work on documentation as well so it's just like a lot of different things all which
Starting point is 00:52:26 are focused on that trying to bridge uh the community and the the developers working on on our tools yeah that sounds pretty familiar yeah yeah that was one of the things that i did do it a bit differently at sonar is that i did occasionally get to work on the product code itself. That's interesting. I implemented a few of the static analysis rules. And I thought that really helped me to be able to talk about the product more authentically
Starting point is 00:52:54 when I've actually worked in it myself. And that's one thing that did find missing a lot of JetBrains was I, I mean, I could have done that as well, to be fair. Yeah, you could have done that. I know Tim did, but yeah. Well, for me, it was different because I was actually a developer
Starting point is 00:53:05 on the C-Line team for a while, like working on the parser and stuff. So I was very much in the weeds of it. But then when I became a developer advocate, at that point, I chose to not look at that code anymore and rather be like the first user to have that extra distance. And I found that to be extra helpful
Starting point is 00:53:22 because I still knew what was going on in the hood, but I didn't get stuck in the code like i could focus on i'm trying to be like a user here right and yeah yeah um i thought i found that helpful but i think maybe it's cool that like everybody interprets this role in a slightly different way right i didn't have cats like cats are great i think especially for me like i i get a lot of leeway in defining my role myself. So like, you know, when I did the work on the Minitc extensions for Suits Expected, I was just like, hey, I want to do some open source stuff. You know, I worked on the proposal for Minitc optional.
Starting point is 00:53:59 So maybe I'll just implement this feature in the standard library. And I just kind of did it and just told my manager, yeah, I'm going to do this. And he was like, yeah, fine. So I get a lot of agency and what I work on. And if I want to do more coding focused stuff than I can, or if I want to do more like conference-y stuff than I can, of course, sometimes there's things that you,
Starting point is 00:54:25 you have to work on and there's always stuff that needs done to, to kind of keep the lights on like release notes and internal newsletters and all that. But, uh. So that's interesting. So at JetPace, there was another person for like release notes and all that kind of release management. So for me, like whenever there was a release the main thing was you know if there's like a video that needs to go out saying like you know here's like all the new features so here's like a tutorial on this particular new feature that's going to be in this version then I would do that but like I wouldn't write the release notes there was like a you know somebody else who was doing the release management so so the day of the actual release I was kind of you know
Starting point is 00:55:03 twiddling my thumbs or doing other stuff. That was actually quite pleasant. Phil, was that your experience as well? More or less. I think there's technically a different role to work on anything more documentation-oriented, which includes release notes. But it's close enough that at a push, a developer can step in and help out, or you can take on that role depending on the organization. So I have sort of delved into a bit more the documentation side in the past. And I have to say, it's not my strong suit, but you can do it. Yeah. For me, it's kind of changed over time. Like at the, when I first joined, was it five years ago now, I didn't touch the release notes at all. And then I kind of inherited them off of someone and was like pushing them entirely myself and now i kind of delegate a lot of it and
Starting point is 00:55:52 just tell all of the other folks working on things being like hey here's the release notes page here's the the deadline please get stuff in on time, otherwise I will annoy you. Right. Well, I'm sure most of our listeners don't want to hear us reminiscing about developer advocacy all day, but we are approaching the end and we haven't asked our magic question yet, which is, is there anything else in the world of C++ going on right now that you find particularly exciting or interesting i think uh reflection and this has probably been my answer for for several years now uh you know before i got into came up in the uh in the developer server you talked about earlier that's one of the word clouds yes yeah yeah it was like it's been the top for for several years now yeah yeah not just you yeah
Starting point is 00:56:41 before i got into c++ uh my favorite language was Common Lisp. So I've always been like a massive metaprogramming nerd and having something in C++ for doing like reflection and then maybe even getting like the code injection stuff that was in the like Herb's metaclasses proposals and things like that. That's all very exciting for me what do you think of the the latest proposal yeah i think i'm still getting to
Starting point is 00:57:12 grips with all of the syntax of it and and things like that but uh you know people have been working on this stuff for for so long and there's so many uh little details to get right and and things like that i'll just be happy when we've got something usable that that we can use for like serialization and all of the kind of things which are massively painful without reflection like converting enums to strings even like oh god the amount of that stuff i had to do for this dwarf parser is like an absolute nightmare. Right. So yeah, but there's got to be some drama, I think,
Starting point is 00:57:50 around this a little bit, at least. I think the last thing I heard last month in Tokyo was that the carrot operator for reflecting on something is kind of an over-minded buddy, I think, for Clang, because they said the carrot operator is owned by like objective c++ it has like a meaning object we see this last and you just you can't use that um so yeah it's gonna be it's gonna be interesting it's gonna it's not gonna look exactly as it does now in the paper when it is standardized but i i am very very hopeful that we're gonna get it
Starting point is 00:58:21 on css 26 i think that's gonna be a massive shift and like the expressivity of the language and what you can do with that it's gonna yeah it's gonna get really exciting again to program and see the sass like yeah yeah very excited to see what cursed things i can come up with not that you can't come up with enough cursed things well there's always more cursed things you can work right right well that's where c++ and wifty live is exactly yeah that's why we love it Well, there's always more, Chris, things you can work with. Right. Well, that's where C++ always delivers. Exactly, yeah.
Starting point is 00:58:48 That's why we love it. All right, well, anything else you want to let us know before we do let you go? Like, you know, where people can reach you or anything else you want to direct them to? Yeah, if you want to check out the code base for that dwarf thing, that's at github.com slash tartanlama slash dwarf bf uh
Starting point is 00:59:06 well i'll send you a link for the the show notes but yeah you can reach me on i don't even know these days like you know with twitter kind of dying i've just kind of tried to avoid social media stuff as much as i can but yeah you can you can tag me there or uh or you can find my email around the web uh but yeah please do get in touch if you're um interested in any of the stuff i've talked about and please do sign up for pure virtual c++ as well yeah well thank you very much for coming on the show telling us us all about pure virtual C++ and all the other things you've been working on at Microsoft. It's been great to see you again. Yeah, you too.
Starting point is 00:59:51 Thanks so much for listening in as we chat about C++. 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 guest or 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 it if you can follow CppCast on Twitter or Mastodon. You can also follow me and Phil individually on Twitter or Mastodon.
Starting point is 01:00:15 All those links, as well as the show notes, can be found on the podcast website at cppcast.com. The theme music for this episode was provided by podcastthemes.com.

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