CppCast - News and Catching Up

Episode Date: August 12, 2021

Rob and Jason talk about C++ news, upcoming conferences, tooling updates and a bit about the C++ projects they work on in their day jobs. News NDC TechTown Keynote and Class CppCon Practical ...Performance Practices CppCon Big Update with Big Thanks for a Big Program You're Doing IoT RNG Remove nodiscard annotations from the standard library specification std::span is not zero-cost because of the ms abi /r/cpp - Does anyone ever use goto in their code? /r/cpp - Github actions to setup gcc/clang/mingw /r/cpp - Am I going to be burned at the stake for using basic_string as an integer array? ReSharper C++ 2021.2: Type Conversion Hints, Immutability Inspections, Inline Function Moving a project to C++ named Modules Sponsors PVS-Studio Learns What strlen is All About PVS-Studio podcast transcripts

Transcript
Discussion (0)
Starting point is 00:00:00 Episode 312 of CppCast recorded August 11th, 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 catch up to discuss the news. We also talk a bit about our own C++ developers. I'm your host, Rob Irving, joined by my co-host, Jason Turner. Jason, welcome back. Hey, thanks, Rob. Yeah, I heard Matt said that he tried to do his best impression of me or something like that.
Starting point is 00:01:27 It was great having him on the show. It's been a while since we've talked to him on CPCast, at least. Right. I didn't go back and listen to the episode, so I hope it did go well. It did. It did go very well. I do want to make a public apology to our our guest we had on last week dennis because i didn't realize that we'd had him on before i i didn't realize until i was editing the show and uh putting together the show notes that we had him on like two years ago i i completely forgot i didn't recognize his face um he had grown a beard since we last had him on so i was blaming blaming that but blame the beard People always blame the beard. Yeah.
Starting point is 00:02:08 So yeah, if anyone was wondering if he sounded familiar, he was a returning guest. It was great having him on. That's unfortunate. Yeah. Well, at the top of every episode, I like to read a piece of feedback. We got this tweet from David Faconte,
Starting point is 00:02:21 and he says, When I go to the gym, I often listen to the latest cpp cast episodes you may learn a lot of interesting things about the c++ community and uh yeah thanks for listening to us at the gym i haven't been going back to the gym yet how about you jason are you doing anything like that yet back in 2019 when we were really like traveling all the time we canceled our gym membership and invested in some home gym at home, which was just absolutely perfect timing because otherwise we would have had to have fought the rest of the planet for, you know, hunks of steel. Um, yeah, yeah. Like that was hard to do for a
Starting point is 00:02:58 while. I think I have some other friends who did the same thing early on in the pandemic. Yeah. I bought like one piece of equipment during the middle of all that. And it was no problem, but like it's an adjustable kettlebell, but any of the like add-on weights are I think still unavailable from the same company. And that's just, yeah, that's crazy. Yeah, definitely.
Starting point is 00:03:20 Well, we'd love to hear your thoughts about the show. You can always reach out to us on facebook twitter or email us at feedback at cppcast.com and don't forget to leave us a review on itunes or subscribe on youtube uh so it's been a while since you know you and i've been together so we decided to just do a news episode today which we haven't done i think in a very long time i think it's necessary from time to time. People say they like it. Yeah, yeah, people always say they like them.
Starting point is 00:03:49 And we were able to find, you know, plenty of stuff to talk about. Well, so on the note of stuff to talk about, there was a little bit of effort last week when I was gone to try to get you to talk about yourself, but you just said no. You know, for listeners who are curious, I work on a geospatial mapping application for my day job. I always feel like I don't have that much novel and interesting things to talk about. Rob, we've learned that everyone has something different and interesting to talk about. I also do a fair amount of my work, my day job work, in C Sharp land, too.
Starting point is 00:04:30 I kind of go back and forth between C++ and C Sharp a lot. But pretty much most of your career has been in mapping in some way, right? Yeah. Yeah. Before my current job, which is working on an app for DoD, I used to work on a GPS navigation app called Copilot. Right, which some of our listeners might know. Yeah.
Starting point is 00:04:50 Does Copilot still exist as an Android app, or did it just kind of get pushed out by... I believe it still does. Okay. Yeah, I mean, when I was working there, it was always getting pretty stiff competition from just the built-in apps you can get, like Google Maps and Apple Maps. But yeah, it's still an option there. Cool. Yeah. Well, let's start with talking about a couple of things you have coming up, Jason, you want to share these?
Starting point is 00:05:16 Yeah, this is my shameless self-promotion segment of the hour here, I guess. So we've kind of talked around this a little bit but i i have been asked to keynote at indec tech town and that's coming up in norway and you know what i actually have to double check what the dates are because uh if things return to normal travel wise by the end of the year i'm gonna actually end up with a pretty busy schedule. So that is the 18th through the 21st of October. And that's in Kongsberg, Norway. And so let's see, the title of my keynote is garbage in pearls out. Oh, that sounds interesting. Yeah, you know, I don't think I'm going to talk about any kind of novel idea. It's just
Starting point is 00:06:03 experience that I had on a really fun project that I worked on a long time ago. And I just thought it would make a good story for a keynote and maybe, maybe get some people thinking in a different way a little bit. Uh, but at the moment, Norway has not opened up to tourists at all. So I don't even know if I'm going to be allowed to go to Norway. We'll see. You said it was October? October 18th through the 21st, yeah. That's what I have on my calendar.
Starting point is 00:06:31 I hope it's the right days. What does NDC Tech Town do if you can't travel? Are you going to do a remote keynote, or do they just find someone else? Yeah, I told them that I would be willing to do the keynote remote if they want me to. But I'm also supposed to offer a two-day workshop there. And I said that I, as we've talked about on the show, not interested in doing a two-day remote workshop, particularly with an eight-hour time difference between me and the students.
Starting point is 00:06:59 Yeah, that would be rough. They are. And that's practical performance practices, which I gave a talk called practical performance practices at C plus plus now. Mm. Two thousand sixteen, 17. Uh,
Starting point is 00:07:20 something like that. It was a really popular talk. People liked it. I had a lot of fun with it. And I thought, you know, this seems like something that I could make into a two day class where, um, I distill down the lessons that I've learned into like, you know, practical application for your code, but it's, it's basically the intersection of where best practices meet, um, meet performance concerns. Okay. Uh, and I, I think that should be a good one. It's going to be new material.
Starting point is 00:07:48 So if you've been to any of my other classes or whatever. And then the next week is CBPCon. Right. Like literally the next week. Yeah, I've got like three days to get home and back on the right time zone. And then, or no, two days to get home and back on the right time zone and then or no two days to get home and back on the right time zone and then do
Starting point is 00:08:06 a pre-conference practical performance practices at cvp con here in colorado and that'll be saturday the 23rd and sunday the 24th of october yeah right yes so if i fly back like thursday night get home friday and then teach on Saturday and Sunday is the plan. It's like all the things that I thought made 2019, you know, exhausting and said I wouldn't do again. I volunteered to do again for 2021. I hope you're able to get over the jet lag on that Friday. It's why they serve coffee at conference classes. Do you know if you have a regular talk in the schedule for ZVPCon?
Starting point is 00:08:48 I submitted a talk. It hasn't been accepted one way or the other yet. They haven't put out that notification yet. Not as far as I know. Maybe it was an email that came while I was on vacation last week and I didn't notice. Okay. Well, speaking of that, that does bring us to our next uh article here is blog post from john kalb a big update with big thanks for a big program and obviously this is about cpp con
Starting point is 00:09:13 and yeah their program committee is hard at work reviewing and rating all the submissions they've had uh john says here that they received over 200 submissions which i think is a record for them yeah or near record number of submissions yeah oh near record i okay yeah yeah um and he did does also mention that the quality of uh the submissions were extremely high and that the you know number of submissions they're gonna have to turn away that are still very high quality will be very large. Yeah, who knows? Maybe I didn't get accepted for a CDP con talk at that rate. Well, you'll find out either way soon, I believe, right? Yeah, presumably. The early bird tickets have already expired, although I know I've been accepted for a class, so I don't have to worry about that. I'll be allowed to go to the conference anyhow.
Starting point is 00:10:06 But yeah. Right. And it also does say here that most of the submissions, I think you can choose between whether you want to do online or on site. And most of the submissions were on site. Yeah, it was interesting. So when you submitted it, I think your options were on site only, online only, or either. Okay.
Starting point is 00:10:25 And then they just sent an email out like 10 days ago asking everyone who had submitted if you could give like a 1 to 10 scale of how likely you are to actually be able to come on-site so they can try to figure that out. But yeah, that's going to be different to this mixed environment. Yeah, especially with... It'll be interesting to see how it goes because obviously uh as we were talking right before the show started you know we were thinking everything might have been over like a month ago
Starting point is 00:10:56 and now things are ramping up again it seems on the upside i've seen some statistics granted it was like three weeks ago, so I don't know if these have held true, that it seemed that the Delta variant, which is spreading so easily and so quickly, seems to be burning itself out relatively quickly, like where it first hit hard in England, and only six weeks or something like that,
Starting point is 00:11:23 it was basically gone because it had moved through so fast. Okay. Well, that's good. That's good news. On that note, get vaccinated if you can. If you're able to get the vaccine, you definitely should. We both have it. We're fine.
Starting point is 00:11:40 Neither one of us has turned into a zombie yet. Has your DNA been reconfigured? Have you grown a third arm? No, I haven't grown a third arm. Um, I'm pretty sure I don't have a tracking chip from, you know, Bill Gates, Microsoft in me. Probably not. Yeah. They're, they're tracking me through my phone, but that's not Microsoft. That'd be Google and Android and Samsung, I guess. Yeah. I'm being attractive. I even own a Google phone. I can't believe I did that, but it was the best option. Yeah. Okay. So this next one is an article you found and it's from Bishop Fox Labs and it's you're doing iot rng slash wrong yeah so a friend of mine and i think i've mentioned him on the side before does security res we he's his career has intersected
Starting point is 00:12:35 with security in some way for like always so he sees these articles and then ships them my way sometimes um and i i love it and sometimes. And I love it. And some of these things. Yeah, it was a very long article. I certainly learned some things that I didn't really know about random number generation. It basically focuses on how, if you're writing like embedded software on IoT devices
Starting point is 00:12:59 and you need to get a random number, you have this API to call directly to the hardware random number generator. And the article goes into lots of detail into why this doesn't always work very well. You can wind up getting just a zero back, which is not very random. And the author of the article is suggesting that all these iot devices
Starting point is 00:13:27 should really have the same type of random number generator that an actual operating system has where it's gathering randomness from multiple different sources not just the hardware right yeah and seeding like using real entropy to seed a pseudo random number generator so that you always have a cryptographically random number available to you like you dev you random on linux i guess right well always return something from i from its pool of entropy or pseudo random number yeah it's definitely wild that you know you could ask for a random number and just get nothing or or get zero or you know an uninitialized you know chunk of memory for your random number like that is pretty wild but uh as the author points out you know there is a return code to these methods and and you should
Starting point is 00:14:18 check it and apparently no one does like no one is they scoured github for all these examples where people are calling into these uh iot hardware random number generators and showed you know all these examples of people not checking the uh return code yeah it seems like i'm not being a security person myself but kind of going with what linux allows that if you just like if you try to get the random number back from your hardware and you do get an error code because part of the problem is they're like well if we get an error code what do we do we can't just crash now we have to do something but a part of the problem like you said is the API you're passing in a pointer to where you want the random number to go and you
Starting point is 00:15:02 get back an error code and if no one checks the error code, if you passed uninitialized memory in, you're going to get uninitialized memory back. If you pass a zero in, you're going to zero back, or sometimes they'll just fill it with zero. But if they did something like keep the last actual random number value and use that to seed a cryptographically pseudo random number generator then they would at least have something available that's not zero or uninitialized memory yeah i guess getting
Starting point is 00:15:34 some repeating values would probably be better than getting zero or getting uninitialized garbage well you wouldn't even get repeating values though if you receded your oh true okay or if you just seeded it with actual entropy at the start i don't know anyhow something to be aware of yeah definitely something to be aware of and i think the author also kind of indicated that this problem should get solved or i guess they're maybe they're just pointing to their solution i don't know so check your return codes. Yeah. Well, that's one. Although they do point out, you know, if you do check your return code,
Starting point is 00:16:09 maybe the best thing you can do is just spin loop until you eventually get a random number. But that's not really a great solution either. Yeah. It comes down to like, what are the sources of entropy that your embedded CPU has? And how often can it fill its entropy buffer? All that just sounds like I'm making stuff up. Yeah. Fun fact, a random number generator on a Commodore 64 can be had by, so there is an actual A
Starting point is 00:16:38 to D converter. There's a couple of them on the Commverse 64, which was for the paddle interface. Okay. So if you didn't have a paddle plugged in there and you try to read from the A to D converter, you're going to get random noise. You're going to get what is the value that the current just happens to be floating at at the moment.
Starting point is 00:16:59 So that old, old hardware actually, in some ways, had a better source of entropy than some of the newer things. These IoT devices. Huh. That's interesting. Yeah. Okay. Next thing we have is a C++ ISO paper.
Starting point is 00:17:17 And this one is remove no discard annotations from the standard library specification. And I know I saw a couple of people linking to this on Twitter over the last week. Yeah. Some people who seem to be very upset about this suggestion. What was your take on it, Jason? Well, you know, I had read this on twitter while i was on vacation and then my friend sent me this article the article we just discussed and i'm reading through it and i'm going
Starting point is 00:17:51 well if these entropy functions were marked no discard then at least the developers would be getting warnings everywhere saying that they're ignoring the error code back yeah i don't think it's to me it doesn't on the surface sound like it's a good idea to tear out all of the no discard requirements from the standard. Yeah, I mean, I don't understand why you would want to undo that work. I don't know.
Starting point is 00:18:21 These arguments don't really seem all that compelling to me, but I'm not in the committee, so I don't know. It seems to come down to, does it make sense for the committee to spend time reviewing every single function to see if it should have no discard on it, and how much industry experience does it take to know whether or not that function should have no discard on it.
Starting point is 00:18:47 Right. But I mean, I think I, some of these things I've never seen, let's say a const member function and something that is clearly just a getter, right? Right. That returns a value.
Starting point is 00:19:00 Why would you ever no discard that? Or why would you ever discard that? Like there's, I think some cases where you can say this 100% rule that this should be applied no discard. And that's where a lot of the interesting bugs are, like empty versus clear. And how much committee time does it really take to evaluate what you're talking about there?
Starting point is 00:19:23 Like, yeah, it's just a getter. Why would you discard this? Let's put no discard there i i don't know i don't know either um and also that i mean he's also this paper author is talking about taking out the work that's already done yeah tear it all which i can see as an argument for consistency like if you're going to say we're going all in or not but yeah like they want to remove no discard from new, you know, like the paper shows all the places where it would be removed from new and allocate and empty and these things like empty, empty really, really needs no discard. We've talked about that, I think, with with STL about the STL.
Starting point is 00:20:04 Right. I think so yeah well it'll be it'll be interesting to see if uh this paper does go anywhere i mean like i said there's definitely a lot of uh twitter backlash that we saw to uh it going out there so maybe most of the committee members will uh we'll vote this down but i guess we have to wait and see yeah we'll have to wait and see i don't know it's i'm sorry i'm just scrolling through all the things that would be removed oh look they added no discard to the result of calling async which returns a future it does seem like that should be no discard anyhow yeah seems that way to me okay uh so this next one is uh is a bug report on uh visual
Starting point is 00:20:49 studio for the visual c++ compiler uh do you want to tell me about this one jason yeah well yeah is it i guess it is a bug report but it's someone complaining that standard span is not zero cost because of microsoft's calling conventions and it's something like i had never stopped to think about before. I spent so much time on Compiler Explorer looking at the Itanium ABI, the 64-bit calling conventions that Linux and macOS use. But since Span, apparently,
Starting point is 00:21:18 Microsoft's calling conventions will never split a struct across two registers when passing it to a function. So even span, which is simply two 64-bit numbers, is never going to be passed as two 64-bit registers, which it would definitely be two 64-bit registers on Itanium calling conventions. They have to set up stack space to store span if you're going to pass it to a function
Starting point is 00:21:44 and then pass a pointer to that on the stack to the function or as a register or whatever. So it has to actually marshal these things around instead of just making it a simple clean copy. It's not really specific to span. It's any small struct that you would expect would be free to pass as not. Right. And this is something that worked differently
Starting point is 00:22:06 on on x86 on x86 it could go just directly to the register oh is that right i missed that part if that's the it looks that way because there's uh you know compiler explorer links here for uh 64 bit and 32 bit and on uh the 32 bit the code is a lot more simple, the generated code. Right. So I take it there's probably not much they can do here, though, without changing the 64-bit calling convention. Talk about an ABI break. Yeah.
Starting point is 00:22:38 That's probably undoable. But there's a comment here there's apparently something like vector call or some sort of pragma that could possibly be used to say no no why didn't you just you know like specially flag this particular type so it gets passed in a different way which might theoretically be an option i don't know something to think about though just in general our assumptions and i've been playing a lot with you know like doing more commodore 64 work with c++ and your assumptions like the general rule of thumb is like if a struct is the size of two pointers or smaller you should always pass it by copy like that's that's something that you know
Starting point is 00:23:24 people may have said in like performance conference talk or something and that works great on like 64-bit linux calling conventions but on my commoner 64 stuff where a pointer is 16 bits but the largest register is 8 bits passing a 32-bit struct by value is actually considerably more expensive than passing it by reference in this weird tiny world that I'm working in. And it's just making me, in stuff like this, reconsider what are the assumptions that I make when I say, well, this is always a good idea or whatever. Well, I guess it's a good thing we do have these tools like Compiler Explorer so that we can quickly evaluate these things.
Starting point is 00:24:07 Go support Compiler Explorer on Patreon if you aren't right now. Yeah, definitely. The 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, data flow analysis. The PVS Studio Learns What
Starting point is 00:24:41 Sterlen 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. Okay, so we have also a couple Reddit posts here that you put in. This first one is, does anyone ever use go to in their code and uh yeah we have a lot of responders here just talking about like no why would you ever use go to the answer is no yeah the only one that sounded like a semi-legitimate use is if you're in like a nested loop and you want to jump out of both loops right at the same time um were there any other ones you're in like a nested loop and you want to jump out of both loops right at the same time um were there any other ones you saw as as a kind of somewhat legitimate
Starting point is 00:25:30 use of go to i think that's the only one that stood out to me pretty much everyone else is like hey you should just be using our aii which is an interesting conversation here because there's a bunch of people that are like basically what is our a AI and how can that help me? And other people explaining how you can, you know, write a utility class that can do your cleanup on function exit or whatever. And that's where a lot of people say they would use go to is to like jump to the end of the function and do cleanup or something like that. Although, you know, this nested loop thing, this issue, I haven't had that question come up in a while because I just keep reorganizing my code so that if I've got like multiple layers of nested loops and I really need to escape from it early,
Starting point is 00:26:13 I put that into a function and return. Okay. Then the compiler is going to handle all of that for me. Yeah. That's certainly a lot cleaner than using a goto. Yeah, or an immediately invoked lambda or something like that. But out of curiosity, does C sharp have gotos? I don't think so. So you don't certainly never used one in C sharp. Have you ever used one in Z plus plus? Yeah, it's been a while. I certainly don't really haven't used in a long time. But I'm sure I have. I honestly don't think I've ever written code with a goto in it since leaving BASIC. Now I feel like I have to just to like...
Starting point is 00:26:53 Go write something with a goto just to say you have. Well, I've actually been intending to make an episode on safely using goto because you actually can safely use goto almost anywhere in C++ because the compiler will stop you if it's a scenario where you can't. Oh, what are the areas where you can't use a goto? You can't jump to after a variable.
Starting point is 00:27:18 Like you can't skip the initialization of a variable. And that comes up inside a switch statement. Like if you have a variable declared in a previous label of a switch block and then try to use it in the next one down you get the same exact error okay uh so yeah a situation like that you can't jump across function calls the compiler won't let you stuff like that that makes sense not that i recommend doing it. Okay. Next thing we have here. This is GitHub actions to set up GCC,
Starting point is 00:27:52 Clang and MinGW. Just looks like kind of a helpful utility, right? Yeah. Yeah. I just feel like this is something our listeners would want to know about. Yeah. So we'll definitely put the link into the show notes,
Starting point is 00:28:04 but yeah, if you're using github actions this could be just a good resource to uh get yourself like bootstrapped yeah it's like do i need gcc 11 and it's like a single statement call to use this action to pull in gcc 11 into your github action that seems pretty handy yeah definitely and then next one we have am i going to be burned at the stake for using basic string of int as an integer array uh this is it's funny that you can do this um you know author points out how how handy it is to use uh basic string of int as opposed to like a vector of int because of you know optimization short string optimization things like that i have no problem with this honestly would you actually use this like in real code though or just to play around with
Starting point is 00:28:56 um if i could prove that there is a good reason to do it then i would like if i knew that in the 99 case i need a vector of like two ints, which would fall into short string optimization, but sometimes it grows bigger than that. Oh yeah, I would be totally cool with, with doing a basic string of ints in that case. Cause I mean, and there's one guy that comments in here that's basically like, well, this is surely less efficient than using vector. Well, it almost certainly isn't because our string classes have been optimized to the ends of the earth. And yeah, there is a video here from Brian Ruth, which was one of my very first students.
Starting point is 00:29:39 He was in the first best practices class that I ever taught, which was at CVPCon. It was the last year CVPCon was in... No. When was that? It was like four years ago, something like that. Anyhow, so... Did we talk to him about this?
Starting point is 00:29:58 I think we did. Yeah, this seems familiar. Yeah. So I had... I was teaching the students, like, know your standard containers. And your list of standard containers that everyone's aware of is deck, list, map, set, multi-map, multi-set, you know, all these things, vector, array. No one stops and thinks basic string is one of the standard containers.
Starting point is 00:30:23 So I mentioned that, and my student Brian was like, well, wait, can I do like a basic string of int? And we all just like stopped for a minute and we're like, wait, yeah. Does that make sense? Sometimes it might make sense, yeah. Okay. Just don't be aware that basic string
Starting point is 00:30:41 requires the type to be trivial. If it's not trivial, things go bad quickly. Does the compiler let you do that? Everyone except for libc++. No, sorry. Libc++ has a static assertion that stops you from putting a non-trivial type in there. The other two do not have a static assertion for that,
Starting point is 00:31:03 and you can get yourself in trouble. Good to know. All right. Next thing we have, we've got an update from JetBrains. This is ReSharper C++ 2021.2. A bunch of new things they're adding here. Type conversion hints, immutability inspections, inline functions. So yeah, one of the things that I thought was really nice
Starting point is 00:31:30 is you can now get a little light bulb suggesting you add const, which is based on the constant and immutability section of the C++ core guidelines. Seems really nice. Yeah, and just for the record, it took me a minute. I thought that I was reading updates about Sea Lion and they're like, wait, wait, wait, this is ReSharper. No, I mean, they probably
Starting point is 00:31:50 have the same engine under the covers. They do have different engines, actually. Do they? Okay. Yeah, yeah. Anyhow. Interesting. And yeah, same thing if you have like a const int you could make that const expert with a nice little light bulb. So, yeah, good stuff.
Starting point is 00:32:06 The one that really jumped out at me here was the, you can create idiomatic bodies of operator functions. So you can do operator plus and then just click on it and say generate this for me. And it will plus all of the numbers together. That was right after the section that you linked to. I'm like, wait a minute that could have saved me some effort yeah that's really nice and there's also some stuff here about
Starting point is 00:32:32 unreal engine uh you know they just had a big release unreal engine 5 and if you're using that resharper c++ uh will you know have good, better support for everything new in Unreal Engine, I guess. Do you use ReSharper in your C Sharp stuff? Mm-hmm. Yeah, I use it for both. Okay. Yeah, it's very nice. So do you do C++ and C Sharp at work? Yeah.
Starting point is 00:32:56 And interact with each other? Yes. So tell us more about that. I mean, still use C++ CLI, which I know some people probably cringe at. But that's kind of the way I go to go from C++ to using C Sharp. Are you able to use the latest and greatest version of C++ in your work? I think we're on 2014 right now. So not latest and greatest, but we're pretty up to date.
Starting point is 00:33:26 What version of Visual Studio? 2019. Oh, so you could theoretically. Yes, but we target other platforms, including Android, where we're using a kind of older version of the NDK. That limits us a bit. Only you didn't have all these dependencies. Would breaking ABI break your stuff?
Starting point is 00:33:45 No, because we were in compile everything all the time. I don't think that's an issue for us. One more vote for breaking ABI. Definitely. Okay, and then the last thing I have is a post on the Visual C++ blog, and this is moving a project to C++ named modules. And the author just goes through the exercise
Starting point is 00:34:08 of first creating a video game, first using just normal, including header files to build it. Did you notice they're using Pixel Game Engine? Yeah, they're using Pixel Game Engine, which we had the author of that on the show not too long ago. Yeah, sorry. Yeah, it's all good. And after creating the game and writing all the code for it, he then goes about updating to use modules instead of include headers.
Starting point is 00:34:37 And it's a small project, but he writes through what kind of steps you need to go through. It all seemed pretty straightforward and uh the the ending he he writes the uh comparison of compile speed and it was 23x wow which is you know it's a small project but that's very significant it went from 3.5 seconds to 0.15 seconds to compile a project it's very nice wow yeah i wonder how much that would hold as you scale into something bigger like yeah yeah i have to be honest because and this article mentions at the top of it like how tooling is still a problem and whatever but they
Starting point is 00:35:19 are using cmake so that's something to consider But for modules and for coroutines both, I kind of feel like I'm still waiting for other people to use them first, and then I'll start using. Yeah, I mean, as nice as this is, I'd really like to see, you know, has anyone gone through this for like their production application? Right. how long did that take for you know something that's millions of lines of code haven't the uh the microsoft people told us that they are using internally for like office or something now i feel like we may have heard that i don't know if they've done a complete conversion i don't know right well you should do it and then report back to us you just said you're using visual studio 2019 so yeah yeah i don't know if i have the uh the bandwidth to to go about that
Starting point is 00:36:13 on my own yeah how long do your projects take to compile are you like caught with these problems uh i'm not you know waiting for hours for it to compile. Okay. It's just a few minutes. Just long enough to do a quick jousting match in the hallway? Yeah, pretty much. I mean, it would certainly be nice to make it faster, but I'm not hurting too badly. How about you?
Starting point is 00:36:38 It depends on the projects. One of them, a clean build, is on the order of something like 10 minutes, and the other one, a clean build, is maybe more like 30 minutes and that's on my 12 core ryzen now with nvme so i've tried to kind of optimize the build process as much as i can it certainly takes time but how often do you need to do a full clean build you know it turns out because of the way my clients the kind of things that they you need to do a full clean build? You know, it turns out because of the way my clients, the kind of things that they ask me to do means that I am often hitting the like top level
Starting point is 00:37:13 headers. So I am probably the one most impacted by build times because I had touched the top level header 10 times trying to like refactor some code and have to wait for the whole project to rebuild again. Right. Okay. Well, I think that's it for today. Right, Jason? That's all I've got. I feel like I talked about myself enough. Is there anything else you want to say about yourself? Well, since you were asking about, you know, my day job stuff, I should say, we did start using CMake and Conan, which has been quite nice. Oh, really? Yeah.
Starting point is 00:37:47 I mean, I'm still spending most of my time in Visual Studio, but we're using CMake to generate those Visual Studio projects and then using the C++ Visual Studio projects that come from CMake. But I've certainly liked making that switch. I certainly like being able to pull everything down from Conan. We used to have just like a bunch of zips checked in to Git, which was not ideal at all. So Conan is certainly preferable than that. Are you using a privately hosted Conan repository or something?
Starting point is 00:38:20 Yeah, yeah. We have an artifactory instance that we put both Conan packages and NuGet packages on. Oh, that's cool. Yeah, it's actually pretty nice. I think that's run by JFrog Artifactory. They have an enterprise support that you can get. Neat. Yeah. So is this the first project you've worked on that actually used Conan to generate your Visual Studio project files?
Starting point is 00:38:45 I mean, excuse me, CMake to generate your Visual Studio project files? It's certainly the first thing I've worked on where I'm actually interacting with CMake. I may have worked on some things where some library is being built with CMake, but I'm not really paying attention to it. It's already set up, happening under the covers. Okay. So I'm old and set in my ways. So my workflow is still to do the checkout, then manually run CMake, then open the Visual Studio project. And I just can't convince myself to tell Visual Studio to open the CMake project directly. And I don't know why I
Starting point is 00:39:18 can't convince myself to do that. So what I wound up doing is because, like i said i have a mix of c sharp and c++ projects all in one solution right and i i want to keep working that way i know that visual studio has you know really good cmake support but that's kind of you're only using cmake so what i've done is if you check out the repository from scratch without running CMake, you'll open up the solution and it will tell you like, hey, I can't find this project. It doesn't exist yet. Okay. So I created a project which just runs the CMake scripts for me.
Starting point is 00:39:59 Interesting. And I build that and then I get all my projects created and populated. I just need to refresh it, and then I'm good. And that's kind of a failure of CMake, because it doesn't have first-level support for C Sharp. Yeah, I mean, I guess if we could have CMake make all those projects, we could fully switch over to CMake. I have done that, but it was very ugly.
Starting point is 00:40:24 I started with a Visual Studio project template and then populated the things that I needed it to. But that was because I was generating C Sharp bindings from C++ with Swig. Yeah. And so I just needed just this tiny little test hardness or whatever in C Sharp or just to compile the CS files that Swig had generated.
Starting point is 00:40:44 So I could script the CS files that Swig had generated. So I could like script the generation of that stuff and then call visual studio to make that build for me. The only other mixed language project I've done is Fortran and Fortran has full support and CMake. Fortran and C++ can go together in CMake. Right. Right. Okay. Well, it was great having you back from your trip, Jason. And yeah, we'll have a regular guest next week to talk to. And we managed to get you to talk about your projects a little bit. Yeah. I don't know why everyone's always asking for me to talk more about my stuff. I don't know. You're like the, I don't know, the figure in the background. You're not the figure in the background. You're the host, but you're somehow mysterious, I guess.
Starting point is 00:41:30 I guess so. I guess so. Okay. Well, it was great catching up. Great going over all this. And like I said, we'll be back with a normal episode next week. All right. Cool.
Starting point is 00:41:41 Thanks, everyone. Thanks so much for listening in as we chat about C++. We'd love to hear what you think of the podcast. All right, cool. Thanks, everyone. 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. And of course you can find all that
Starting point is 00:42:18 info and the show notes on the podcast website at cppcast.com 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.