Bryce

2022, I think, will sort of be remembered, at least like in the systems programming languages community and the C community. 2022 is like Star Wars episode 4, a new hope. The C successor languages.

Conor

Welcome to ADSP the podcast, episode 111, recorded on January 4th, 2023. My name is Connor, and today with my co-host Bryce, we talk about C23 Ranges, our 2022 retro, and the future of C. Okay, actually, we will start the podcast now. I was gonna start off talking about something we need to talk about, which you're probably aware of, but before we just hit the record button, uh, we were talking about ranges. And so I will say, ranges, oh, the glorious they're glorious. C 23 ranges, GCC 13, which is GCC trunk as of you know this recording today, I'm sure GCC 13 will officially, when it gets released, get uploaded to Gobolt or Compiler Explore, uh, has implemented every single range adapter in factory. The only thing they haven't, and I thought Microsoft was leading the charge uh in terms of implementing ranges. So I was tracking their progress and issues, and they have, I don't know, above 50%, I think, of the range adapters implemented. And then I think I was just bored one day. Or no, actually, this is what happened. There's no support for the format library with MSVC on Compiler Explorer. And so I logged a bug, but then the compiler explorer folks said that because of MSVC issues, it's not always possible to get libraries working there, which sure is fair enough. So then I went and downloaded the most recent community edition of Visual Studio and tried to, because I want to use Victor's format library until we have C23 format print. And then when I used uh the community edition, I used Nuget to fetch, I don't know, whatever the most recent um format library is, which is like 7.0 something. Yeah. And that's broken with chunk by. So for whatever reason, there's some bug that the C23 std views chunk buy doesn't work with the lib format library. So compiler explorer doesn't support the format library.

Bryce

You mean I'm confused.

Conor

Like like you're trying to I'm trying to just uh basically use the fumped colon-colon print and the ranges header. So they have basic C23 comes with the ability to print a range uh and containers and stuff like that. Uh but just very necessary if you want to basically create a little gobble snippet um that prints out some code using some C20 or 23 ranges. So Compiler Explorer with MSVC doesn't support the lib format library. And Visual Studio 2022 Community Edition has some bug either in the format library or the ranges, uh C23 ranges uh chunk by implementation that they are not compatible. And so I was I was about to say I got bored, so that's why I checked GCC. But what I realized is like I can just go create the equivalent code using range v3 and libformat because I know libformat works with GCC. But then when I was doing that, I said, I'll just check to see what they've implemented of C23 ranges. And it turns out they've implemented everything, which is just so amazing. So amazing. Uh chunk by.

Bryce

Yeah, I saw Eric Eric retweeted something that you sent about this, and Eric said that that this is great because when you look at the the what ranges looks like as of C23, this is a lot closer to what his original vision for ranges was because when ranges was put into C20, um uh just because of the scope and size of it, a lot of it had to be paired back. A lot of the important uh range adapters were were left out of the initial pass, and now a lot of them have been added in 23.

Conor

Yep, it's uh it's beautiful. That's I've decided for the couple C conferences that I'm gonna submit to, one of them I already submitted to.

Bryce

Which one?

Conor

Uh C on C. Oh, they're open already. It uh I believe the call for papers is open until January 8th, and this is getting recorded a couple days before that and will get released. When will this get released? On January 6th. So if you're listening to this between January 6th and January 8th, I mean there's a chance that the call for papers might get extended. But yeah, I mean, I um this is before they've you know started accepting. So it might not get accepted, but I plan to submit it to a couple of C conferences. So hopefully one of them, it'll get accepted. And it's just gonna be a talk basically covering what everything that's new in C23 ranges, and also an overview of the algorithmslash range landscape, because it's actually like hella confusing now. If you're just coming to C23, even C20, there are now basically three different ways to call transform algorithm. There's the iterator overload, there's the range overload, and that's sort of like one vertical. And now there's like range land, which technically like they don't call those algorithms. They're range adapters and range factories, which I mean I consider them all under like the algorithm umbrella. But if you're coming to C as like a new C programmer, and you go, you Google like how do I, you know, map, how do I do a functional map kind of thing, you're potentially gonna get like three different answers. Anyway, so I think some little like mini lightning talk at the beginning of uh what's new in C23 ranges that talks about like there's like two different verticals and there's two different overloads in this vertical, but really if you're trying to do like functional composition kind of things, just stick to this vertical. Anyways, that's all some mini side note. What I really wanted to mention, happy new year, by the way, because it is now 2023. Yeah, happy new year. Did you hear the big news? That happened right at the end of the new year in the C podcast world, Bryce. Did you hear the big news?

Bryce

I didn't directly hear it, but I saw some tweets uh uh that did not directly mention it, and I suspect I based on those tweets that I know what the news is, is a certain other podcast, but have we fallen in the rankings?

Conor

Well, so yes. I mean, I am both I'm conflicted now. I'm both one, very excited, kinda sad that it's not so wait, for the listener that is not informed and not in the know, CPP cast, the number one podcast by all measures, and the first, and at one point was the only, but then in 2022, like four podcasts started in two months, one of which was ours, um, is back. It's kind of sad because it's not Rob and Jason that are coming back to host it. It's two new hosts, Phil Nash and Timur Doonler. I hope I'm pronounced pronouncing uh Teamer's name correctly. And very interestingly, I actually plan on making a YouTube video about this because like the landscape of C podcasts, Phil, this is technically Phil's third C podcast that he's co-hosting because he did CPP chat uh initially, and then he did a podcast called No Diagnostic Required, and now he's taking the what do you call it, steering wheel of uh this pirate ship that is CPP cast. And uh I'm conflicted because one, obviously it's one of my favorite podcasts of all time, so happy that it's coming back. But two, then what does that mean for us? You know, we were on track to be. I mean, we were the number one active C podcast, although kind of we're like a Core period slash Rust podcast. Um, but now they're back, and also two, so they're not gonna be releasing episodes every week, it's gonna be every two weeks for now, which means that now it's gonna take us twice as long to catch up episode-wise, which they're at 350. We're at like what 111, which is 240. So divided by 50 weeks is roughly that would have been five years. Now it's gonna take 10 years.

Bryce

Wait, wait, is it they're not weekly?

Conor

No, they're gonna be bi-weekly, so twice a month, once every two weeks.

Bryce

Was it previous wasn't it previously weekly?

Conor

It was previously weekly. Yeah, I think they're trying to make it.

Bryce

Yeah, but we will we will still eventually catch up.

Conor

Yeah, I mean, we're like you said, we're doing this till one of us dies, so as long as we can hang on for a decade, both of us, we will be able to episode-wise. Anyways, your thoughts and feelings. Um I know you're not a big podcast listener, so I guess you're probably much less excited about this than uh than I was.

Bryce

Well, I mean, I do listen to a decent number of podcasts, I guess, just not programme podcasts. Um I mean, I think it's great. I think it's it it was really sad that CPB cast um uh that the original hosts, you know, were were decided that it was time to move on. Um because it it was, I think, uh an important part of the the ecosystem in the community. Um uh, you know, not everybody consumes content uh uh or consumes uh things the same way. You know, some people prefer podcasts, some people prefer conference talks. Um and I I know that there was a lot of people who you know listen to every episode of CPP Cast. And uh C P kind of needs a marquee um uh uh podcast. You know, this is not this is a very different podcast than their podcast. Like CPP Cast is actually uh C podcast and you know covers all the made the latest developments, major news. We just you know talk about whatever we want. So um, you know, there was a gap, and uh I'm glad to see that that uh that it's back with uh new hosts, and I think those are two great hosts. Um it'll be interesting to see whether they um uh change up the format at all.

Conor

Um it seems like based off of what they did in the first episode, because what they did is halfway through they were sort of interviewing each other and then they did like a little record scratch, and then like they said, let's start it from the top, because like they were the new host now, and they did the exact same sort of intro news for a little bit and then sort of intro interviewed.

Bryce

But I I mean, you know, the you're obviously not gonna come into a thing and just immediately change everything unless you're Elon Musk. Um, so but you know, over time maybe they'll maybe they'll um decide that there's some things they want to change or that there's some things they want to innovate.

Conor

It's true. I wouldn't be surprised if there's a new jingle, because um not you probably didn't see this, but uh C on C's YouTube channel just released a video um of Phil Nash singing a C song called I Build Myself.

Bryce

And uh Yeah, he I seem to recall listening to a live live performance of something like this when I was at CPP on C last year.

Conor

Oh, you saw it live. Wow.

Bryce

That's I think so.

Conor

That's impressive. And speaking of, we're gonna get into today's topic, which is gonna be the 2022 retro, but uh the on the last on the topic of podcasts and stuff, we actually got mentioned um in some top 10 tech programming podcasts of 2022 on some Twitter Twitter thread, but um for the description, it just took the first sentence of our podcast description, which was we're a podcast inspired by Magic Read Along, which is at this point a podcast that like less people know about than our podcast. So then I was like, oh snap, like and that's all they said, like they didn't say anything else, and I was like, maybe that is a bad description. So I went and updated our podcast description, so it uh is more descriptive of what we actually talk about, anyways. 2022 retro. First of all, how was the holidays? You have a good time time off with family friends?

Bryce

Yeah, we uh went to Florida, uh, visited my parents. Um, it was uh bitterly cold the first two to three days, which I mean at least it was warmer than than than uh than New York. It was like in the in the 30s and 40s the first two to three days we were in Florida. But then it got uh the weather got a bit better. Um we spent some time chilling out in the pool. We went on a boat. Nice um Yeah, we did all the all the Florida things. Didn't go to the beach. Not really that uh that part of Florida, and also we're just not really beach people. Um we're all very very pale. We uh we burn very easily.

Conor

That's what they have umbrellas for.

Bryce

Yeah, yeah. Yeah, it's it's funny in uh and sun un and sunscreen. Um my my parents live in uh this very nice um gated community um uh just south of Tampa. Um and I I was um uh born in Tampa. My my mother uh who was a bankruptcy lawyer, she um went to uh Cornell uh for her undergrad. Cornell was in upstate New York. Um that that in that part of New York that gets very cold and gets a ton of snow during the winter. Um and she she grew up uh in Long Island, um uh and then decided that Long Island wasn't cold enough, so she went to Cornell for undergrad. Um and then she decided that you know Cornell was not cold enough. So then she went to the University of Chicago for graduate school, um which is an even colder and and for for uh for law school, um uh which is even colder. And then after that, and and she hates the cold. So then after that, she's like, you know what, I'm I am done with being in cold places, I am going to go, you know, as far south as I can. So she went to uh to Tampa where she started practicing law, and she was the uh the first female attorney at an uh uh a good old boys southern law firm. And there are lots of interesting and amusing stories uh about that. Um but that's the uh uh that that's that's why they're in that part of uh of Florida in the just south of Tampa, um, because that's where she lived for a number of years, that's where I was born. Um I don't usually like to talk about the fact that I am technically a Floridian.

Conor

I think this is the second time it's come up on the podcast, yes. And you always post fix it with uh try not to.

Bryce

But they're now and they're in this this very nice uh little gated community.

Conor

Are the gates it's you've mentioned that twice now. Are the gates important in uh Florida?

Bryce

Yeah, oh yeah. But so in these like gated communities in Florida, um they have these like super powerful HOAs, homeowner associations that uh you know tell you, you know, your house has to be this color, and you know, you can can't have, you know, uh don't leave your garage door open uh because nobody wants to see the inside of your garage, and and you know, you you can't put lawn gnomes on your lawn and stuff like that. Are you serious? All the houses sort of look look very similar. And um in Florida, in these communities, they have this thing that that they call Lanai, which I'm convinced is something that only people in Florida know about.

Conor

Can you spell that N-I-G-H?

Bryce

I have no idea how to spell it. Lanai. Or Lanai. Okay. Yeah, I think it starts with an L. Um And it's like this it's basically like a backyard that's covered in this um structure that has like this mesh um stuff. And so it's like you're outside, you get the sun, you know, if it rains, the rain comes through, but the mesh keeps out like leaves and bugs and stuff like that. And so you have one of these that covers your like backyard and your pool um and your hot tub.

Conor

Um how do you get the leaves off of it when the leaves get caught by this thing?

Bryce

What?

Conor

How do you get the leaves off of like if if it's this mesh net kind of thing that's keeping the leaves out?

Bryce

You gotta you have a guy for that.

Conor

He just what goes around like a really tall skin.

Bryce

I think it's it's mostly like to keep the bugs out, so you like don't have to have like mosquitoes and stuff like that.

Conor

All right.

Bryce

Um and so like then everybody who lives in these little gated communities, they have like, you know, they have their indoor kitchen and then they have their outdoor kitchen. Um, which is funny in my my parents' house because their indoor kitchen and their is in the back of the house. So it's about it's about ten feet away from their outdoor kitchen. Um and then they have like their indoor dining table and their outdoor dining table. And then they have their, you know, they have their living room with their TV, and then there's a TV outdoors in the Lanai. So you can watch TV from the hot tub. Um it it's just it's a very interesting lifestyle down there.

Conor

I've gotten like I'm getting like Wally vibes from like uh, you know. I don't know why.

Bryce

I I think I think more like uh Stepford Wives.

Conor

It's like the you know, the everyone's on a track, you know, there's no lot there's no creativity, you can't keep your you know, your garage door open, you know, it's yeah, same uh everyone's got the same paint on their houses and uh There's this one house in the neighborhood that's painted in this, I I think, you know, not awful pale green color.

Bryce

And apparently it was a big controversy. Um the pale green color was one of the like four or five approved colors that you could paint your house. But like nobody picked that color. Everybody else picked like one of the, you know, one of the three shades of beige and brown. Um, but this one couple picked this green, and everybody else, you know, you you're not gonna remember what like the five different options for house color when you picked your house. And so everybody else just assumes, oh, they this is a non-approved color. And and so then they complain to the HOA, but the HOA is like, no, actually, they're allowed to have their house that color. And apparently it's a whole big hubbub.

Conor

Wow.

Bryce

There was one couple my mom was telling me about one couple moved in and um they painted their um their house red, um, like not approved shade of red. And the HOA is like, nope, you gotta paint it back. And apparently and I and and so we asked, what would happen if you just said no? Well, then the HOA would uh uh start giving you a daily fine, and if you don't pay that, then eventually they could get a lien on your house and take your house because you painted it a different color.

Conor

This sounds like not real. Like what group of what group of people put this gate up and then had a meeting and they were like, Alright, folks, what are the ground rules here? Like nothing on the lawn, it needs to be the same color. Like, who cares? I get clearly these people do.

Bryce

I mean, like the gate keeps like unauthorized vehicles out, but there's like a two-foot gap under the gate, and uh like it's not that tall a gate. Like you you could get in if you wanted to. Yeah.

Conor

Alright, so so let's um The things you learn on uh ADSP the podcast. Alright, 2022 retro. Go. What's your your top three, your top five?

Bryce

Well, okay. So so uh so I'm gonna give you my I'm gonna I'm gonna I have to tell you part of my 2023, you know, predictions at the same time.

Conor

Well, no, we usually we save our uh 2023 looking forward for a separate episode, so you gotta split those up. Unless if they're intertwined, in which case we can do something different this year.

Bryce

They they are intertwined.

Conor

Alright, you go right ahead. You do you do you do you, Bryce.

Bryce

Twenty 2022, I think, will sort of be remember at least like in the system's programming languages uh community and the C community. 2022 is like Star Wars Episode 4, A New Ho. The C successor languages. Um we've had um you know, the announcement of uh Carbon.

Conor

Wait, wait, wait. I have to interrupt. What is the scene of uh Anakin trying to jump over uh uh Obi-Wan and uh you know, you lie, what are the what does he say? Oh I have the oh yeah, I have the upper ground. Yeah, yeah. And then he ends up getting his legs cut off, and then he's burning at the side. What is uh what is that map to in your analogy here, bro?

Bryce

I uh no comment. No comment. That's just a typical C user's experience with a compiler.

Conor

I'm gonna cut in I'm gonna cut in uh the actual audio from uh from that.

Bryce

That's that's just that's just what happens when you uh you know write some some bad template heavy C code and the compiler punishes you for it.

Conor

Maybe I'll join maybe I'll join uh TikTok or something uh and and create some little meme of like uh Obi-Wan being the compiler and Anakin being the C developer.

Bryce

It's like don't well and I think like earlier the before he says I have the high ground, he you know he's I think he says something like uh like don't try it, I have the high ground. And that's like the commander like like don't try it. You're you're you're gonna be unhappy. You were the chosen one.

Conor

All right, I interrupted you, sorry. So it was the Okay, all right.

Bryce

So um Year of Successor Languages. 2022 Um is I think gonna be remembered as the the year of the C successor languages. Um there's you know carbon. Um I think there's there's been growing interest in developments all around Circle. Um uh did did Sean give his keynote on on Circle at C now last year in 2022. I think that was the year.

Conor

I think it was 2022, yeah, because we talked to him about um yeah, we talked about it on this podcast. Yeah, and uh we also had him on where he talked about it. Great episode if you haven't seen heard that one.

Bryce

Um there's also Dave Abraham's language Val. Um uh there's uh CPP2. Um what awesome I forgot in any others.

Conor

Um I mean, technically Yacht, which is the language being developed inside Serenity OS, but I don't think that we haven't heard much about that being a successor language, but that is, you know, in the space of There's also been growing uh interest in success for Rust.

Bryce

Um one thing in particular there that I think was sort of a hallmark moment was um uh the first Rust code getting into the Linux kernel. Um, you know, that's that's a place that C has not been. Um so okay, so if uh if 2022 has been, you know, s uh Star Wars Episode 4 or A New Hope, then of course 2023 will be episode 5, Empire Strikes Back. Um uh I I think that uh one of the themes of next year will be um uh languages like C and C responding to uh uh the uh successor languages and responding to the uh criticisms of them, the claims that they are legacy languages. Um one of the other things that happened in 2022, um there were some US government agency that put out some cybersecurity advisory which you know suggested that uh C and C were unsafe uh languages or unsuitable languages because of the memory safety concerns. Um uh or at least set somebody interpreted the advisory they put out in that way. Um and and so what what what will what will the Empire's strike back be NSA in 2023? It was the Who?

Conor

The NSA, yeah.

Bryce

Yeah, the NSA.

Conor

And there was like the two big things where the Microsoft Azure CTO saying that like C should be deprecated as a new language that new projects use, and the NSA came out saying memory safe languages are the way to go.

Bryce

Yeah. I don't think they explicitly said don't use C and C. They just said use memory safe languages. And some people interpret that uh interpreted that as um don't use C and C. Um so how will the Empire strike back? Well, um C23 and C23 will be published and go out the door this year, and we will see um uh implementations uh start shipping support for uh C23 and C23 this year. Um I think Fortran may also the next revision may go out this year, but uh don't quote me on that. I don't remember the dates exactly. Um but the other thing is that there's been a renewed interest in what we could do in uh uh C to improve um uh uh safety, um, including some very bold proposals that we do things on a um very accelerated timeline. Um one of the interesting proposals is uh from my uh my dear friend JF Bastion, uh who is uh the chair of the uh C evolution working group, and he works at uh Woven Planet now, which is a subsidiary of Toyota, um and he uh wrote a proposal um uh a few years ago, I think, um uh proposing that uh we zero initialize objects of automatic storage duration. Um because one of the um uh leading uh uh causes of uh uh UB that leads to security issues um is reading uninitialized values, um which can uh allow an attacker to um uh uh uh get it information that they shouldn't have been able to, and then thus uh uh control uh execution. Um and I I think it's uh CWE457. Um and uh and so the proposal is is pretty simple. It's just like, hey, like we should just zero initialize objects of automatic storage duration. Um and you know, why don't we do this today? Um well there's obviously you know the performance concern, right? Um, you know, okay, if we have to settle these things to zero, well that requires some work. Um the the proposal from JF actually talks about um uh this in in a good bit of detail. Um it both talks about you know concrete numbers, um, but also in the um, you know, what what why do we see a uh a performance problem? And it's not just the cost of actually setting um uh the uh the values to zero, it can also um uh screw up compiler optimizations. Um it can like break dependencies, um uh uh which can uh uh mess around with various compiler optimizations, and it can also mess uh mess around with um like various hardware uh various optimizations that your that your CPU does um uh when uh scheduling instructions. Um uh but uh JF's paper sort of you know explores the these um uh performance implications and presents some numbers and suggests that that it's it's pretty negligible these days. Um uh that it's uh in a lot of case in the cases where there are regressions and it's usually like less than 0.5%. Um and then in some cases um uh the code actually gets faster. Um and there's also pretty small code size impact. Um so it seems like there's there's not really a strong performance case. I mean, there are some applications, there's some places where um, you know, an uh a plus or minus one percent can actually be a really big deal.

Conor

Wait, you went from uh 0.05 to plus or minus one.

Bryce

Yeah, I'm rounding up.

Conor

Okay. From five basis points to a lot of things.

Bryce

We're talking orders of magnitude here, right?

Conor

I mean that is a different order of magnitude. Um But anyways, we're de uh roughly we're talking about a percentage. Yeah. Or less.

Bryce

Um uh Andre Alexandriscu uh gave a great talk a few years ago um at uh uh where when he was still working at Facebook and he talked about the uh the impact of some performance optimizations that got like a two to three percent improvement um across some like core Facebook code. And he was like, that's actually like a really big deal if you if you look at like this code is deployed at scale, and you know, that actually saves us like millions of dollars. Um uh uh, you know, having to like allowing the code to run two to three percent faster. That means we can have two to three percent less, you know, uh machines in the fleet or or uh two to three percent more throughputs. Like that can, you know, that that can be a big deal. Um, but I think JF's uh argument in this proposal is um uh the performance cost is uh small enough that that the the benefits far outweigh it. And of course, you know, like almost everything in C, there'll be some compiler flag where you'll be able to opt out of it.

Conor

Um I think that's the important part is that the yeah I I remember JF talked about this in his meetup YouTube recording that I saw, and they said that there would be for the people like you know, high frequency trading firms and stuff where uh every little you know cycle matters that you know they're not gonna have to worry about upgrading their compiler and then having a performance degradation um or pessimization because of trying to gain safety for stuff that I'm sure that they don't not that they don't care about safety, but let's be honest. HFT firms care about uh like speed of light.

Bryce

And in addition to a uh uh uh I'm sure there'll be a compiler optimization to just globally turn this off. There the proposal also um uh suggests that we should add a um an uninitialized attribute, which uh a programmer can put on variables that'll that'll indicate, hey, uh, you know, don't zero initialize this.

Conor

Like a like a double double square bracket attribute.

Bryce

Yeah, yeah, yeah. Um but uh the idea here is to get the default right um to uh instead of having a zero initialized attribute that becomes something that everybody has to put on every variable, you make the default that we're going to we're gonna change by default, and if you want to opt out, you add this attribute. Um which that's not normally how we have done things in C ⁇ . Usually we're like, well, make people opt into the new thing. Um but uh in this case, um uh you know that would have uh I think very limited utility here, and so it's nice to see a proposal that actually suggests that we uh um that we pick the right that we take the right default.

Conor

And what are your thoughts on uh C ⁇ 's ability within this proposal slash outside of this proposal over the next immediate year?

Bryce

You said I think this is low-hanging fruit. Yeah. I mean, I think that's um that's why JF has suggested it, because it's low-hanging fruit. Um it's something that it's pretty easy for us to do. Um uh and it'll it'll address a certain class of vulnerability. It'll make us a little bit more memory safe. Um uh so we should do it. Um it doesn't it's not a full solution, it does doesn't magically make C ⁇ a memory safe language. There's still um many ways in which C ⁇ is uh uh memory unsafe, but this is um this doesn't a lot of those a lot of the ways in which C is memory unsafe, um or a lot a lot of a lot of the common causes of um uh vulnerabilities in C ⁇ come from uh aspects of the language that uh that have fundamental utility. Um like things like pointers or references or the fact that we um we don't have a um uh a safe ownership model of objects like Rust. Um all of those lead to vulnerabilities, but those are all things that if you can't just like change them because they're they provide fundamental utility. Like yeah, yeah, they can be foot guns, but they're also useful tools. Um not zero initializing stack variables doesn't really provide any utility. The reason we don't initialize them is for performance, or historically it's been for performance. But it's not this is not, you know, uh a change which like takes away some functionality from people, right? Right. Um so I I I think it's low-hanging fruit, we should just do it.

Conor

The Empire strikes back with potentially an uninitialized attribute. Which like uh it sounds ugly to me, but to be honest, I never write code like that, so like it and maybe that's okay that it's ugly, that you know, most of the times you shouldn't be doing that and making a bad choice ugly. Maybe not bad choice, but like a for the majority of times a bad choice. I'm sure there are cases where you know there are there's a reason why there's a whole set of uninitialized algorithms that uh they exist for a reason. Yeah. Thanks for listening. We hope you enjoyed and have a great day.