Ben

Contracts, still execution, reflection. But from my point of view, those three things stand out as the big ticket items. Whichever features of C are supported by the compiler I'm currently using at work. And if you're using Clang, or one of you know one of the versions of Clang, Clang actually does a lot of backporting of later C features to earlier C versions.

Conor

My name is Connor, and today with my co-host Ben, we chat about the big feature shipping in C26, GCC versus Clang, and more. Alright, we're back. And how's it going? I mean, we were just chatting for 30 minutes, but we can pretend that we're doing this fresh.

Ben

Spring is here, although we never really had a proper winter here in Denver. It's been very warm.

Conor

You didn't have a everywhere else in like northeastern America was blizzarding for for months, no?

Ben

Well, not here in Denver. We had a couple we had a we had a few inches of snow a couple of times, but no, I mean it's it's 25 degrees out. Wow Celsius.

Conor

Wow. Are you kidding me? That's making me very sad. I mean to Yeah, or even more. Yeah. All right. Some days. The running community in Denver must be thrilled because there's a lot of professional runners that live in the area there because of the altitude.

Ben

Yeah, there's a lot of trail running. I don't know how it is up in the mountains. I mean, the mountains have had snow. It hasn't been super cold though, so maybe it's been more wet. I'm not sure. Interesting.

Conor

Alright. Well, hopefully that weather will make its way up to Canada and Toronto in the future, because we had a brutal, just brutal winter. The worst winter maybe since I've been in Toronto. Okay. Yeah, yeah. It was minus. I think we talked about that last time.

Ben

Yeah, it was snowy out last time. Yeah. I think. And it was like minus what are we going to say? Minus 15, minus 20, something like that.

Conor

Yeah, there were I mean, there was a couple week period where the highest it got was minus seven Celsius. But most of the time it was, yeah, minus 15, minus 20. But yeah, today, today there's no s I mean, I can see a tiny little bit of snow on my neighbor's lawn. But I was out in the backyard raking leaves this morning because it's supposed to rain later and hoping the rain will make the grass start to grow. I don't really know how it works, but I think I think the grass needs water. And so hopefully this is the the end. No more snow. And I guess it was spring. When did spring start? A couple weeks ago?

Ben

The spring equinox was March 21st. Okay, so that's what whether you say that's when spring starts, I think depends, but we could say that. Yeah, spring equinox is well, the moment of equinox, I don't know, it might have been sometimes it's the 20th, but it's it's the 21st, more or less. The Catholic Church defines it as 21st of March, no matter when where no matter where the sun is. Right. You know. For the purposes of calculating Easter, that's the definition of Easter.

Conor

Yes. Which is around the corner now. Good Friday coming up. Which I had forgot was a holiday. Is it a holiday in the States?

Ben

In general, no, although if you work in finance, the New York Stock Exchange is closed that day, so it generally is. Interesting. But for most people, I think no.

Conor

Interesting. So it depends. Depends on the country. Which I guess makes sense. Anyway, so what are we uh what are we chatting about today? I mean, I sent a couple topics, but I also said if you've got stuff you want to chat about.

Ben

Yeah, I don't know. I don't know what I have. I don't really have much since we last talked. I've just been working, doing the normal grind. I don't know that I've been geeking out on algorithms, data structures, and programs very much. Yeah.

Conor

Have you I I don't really follow it too closely anymore. Do you f because I know that the one of the C ISO meetings, I think it was being held outside of London. It was in Croydon. Croydon, yeah. This last week. Have you do you pay attention to the the papers or anything like that?

Ben

I always skim over the papers when they when they go out in the monthly mailings. It's been fairly quiet lately because all the push has been C26 and everything for C Plus 26 has been has been pretty much designed for a year or more now. And so the la the last few mailings haven't been much new and exciting, as much as just little bits here and there. But now that I think C Plus 26 is is done. Just awaiting final approval from the national bodies, I think. And I think and I think C Plus 29 will start to see we'll start to see new and exciting things destined for C Plus plus 29 now.

Conor

Okay. I mean that's I knew that C26 had kind of I was one of the two one or two previous meetings, so that was the one where they were like finalizing, it was the last moment to kind of ship things in, and so now they're in the uh ironing out the bugs and whatnot. Yeah.

Ben

Yeah, so it has it has contracts, it has stood execution. Did con so contracts actually ended up making I heard there was a bunch of kerfuffle contracts are officially in the draft. At this point, I think I think we're past the point where they can be taken out, at least if if C26 were to have sustained national body voting against it, or enough national bodies voting against it that it basically C26 wouldn't ship. It's it's it's not the case that votes can now take contracts out of C26, it's just the case that votes can, in theory, prevent C26 from shipping. I see. But I don't think that's probably going to happen because firstly, because there are a lot more national bodies these days than there used to be. Like back in the day, the number of national bodies in the C plus plus ISO process was less than 10. And now it's I don't know, it's 20 something. Right. So you in order to block C plus plus 26, I think you'd have to have more than a third no votes. Right. And that seems unlikely at this point. Okay, yeah, that makes sense.

Conor

And I guess I the reason I thought that there was kerfuffle, I mean there was, but it was actually kerfuffle from the quote unquote past because I watched in the last couple weeks, or maybe it was a month ago, the panel, the ISO committee panel from CPPCon, which happened back in September, but only got released in the last, whatever, whenever I watched it, within the last month, we'll say. And there was quite a bit of back and forth between panel members of you know, contracts this and contracts that.

Ben

Yeah, there are definitely folks who have who have had sustained opposition to contracts for various reasons. There have been papers that argued for and against. Procedurally, I think, you know, you know, what what happened was what was meant to happen, which is that the national body comments got addressed. That doesn't necessarily mean that everything got quote fixed to make everyone happy and everything sunshine and roses, but it means it means what it means. There is a procedure for addressing these things. Not that I'm any expert, by the way. I should not you should not be listening to me for an expert on these things. But from what I've heard, you know, the procedure played out as the ISO procedure does. And now here we are. Yeah. Um and C26, I would expect to receive enough national body approvals to become the next ISO standard. Yeah, as it always does.

Conor

I mean, it would be very surprising if it didn't. But yes, I interrupted you. So you you started enumerating C26 thing, and then I said, wait, contracts, that got in? And then uh I think you you had mentioned X stood execution, and then that's when I interrupted you. Reflection.

Ben

Reflection. Yeah, I was trying to think through the big ticket items, and I think contracts, std execution, reflection. There's a bunch of other things, of course. But from my point of view, those three things stand out as the big ticket items.

Conor

Are you in the uh Jason Turner camp of waiting till these things show up actually to be used before you start taking them for a spin? Or are you on the compiler explorer forks of claying where it's got some pre-implemented version and you've you've played with reflection already?

Ben

Generally, I haven't really played with reflection. So I'm I'm more forward-looking than Jason. Well, Jason, Jason, you know, is a trainer, he has to deal with he has to be very precise about knowing the differences between all the versions of C. Because you know, he'll go to a place and train them and they're able only to use C20 and not yet C23, for instance. So he has situations like that. So I guess I'm a little more fast and loose. I tend to use not my my usages tend to be not driven by a standard version, but by what the compiler I use supports. Right. So it's not the case that I'm on C20 or I'm on C23. No, I'm I'm on whichever features of C are supported by the compiler I'm currently using at work. And if you're using Clang or one of you know one of the versions of Clang, Clang actually does a lot of backporting of later C features to earlier C versions. Because they take the view that if if the compiler supports it, we'll put it under a feature macro and it'll be available. Even if you say you want C20, if the compiler supports the feature of, let's say, uh destructuring destructuring a pack. Or what was it? Destructuring structure bindings can introduce a pack, is the one I'm thinking of. That feature exists in the latest versions of Clang. They will quite happily compile code that uses that feature, even if you ask for C20. So, you know, as a library author, I sort of find myself I'm always in this sort of halfway house between standard versions, particularly supporting Clang, I am anyway. With GCC, I think they tend to they take a different view, which is like if you ask for C20, that's what you get. That feature, although it exists, although the compiler can support it if you ask for a later version, if you ask for 20, you're not getting it. Whereas Clang does the does the more granular feature backporting. Yeah, it's really interesting.

Conor

And so the newer features are are they always behind a feature macro, or sometimes are they just there?

Ben

Since C20, the newer features have tended to be put behind feature macros. Which is, you know, I again as a library writer, I tend to try to I use those where they are useful sometimes, but I don't like to litter the code with if defs. You know, you you don't really want that either. They're an ISOR, if you can avoid them. It it makes it difficult. It can make it difficult. But sometimes the features are useful enough that in a particular situation you want to say, oh, actually if this feature's available, it's going to be easier to it's going to make this code easy to understand and probably faster to compile.

Conor

Yeah, it's been a while since I was in a heavy C code base, but one of the first companies I worked for, or the first company I worked for out of school, arguably abused the feature feature and they had a ton of different what they called modules without giving away too much whatever insider info. And so you would you would have constantly these, you know, if ding ding-ding, and it would be or or or and I remember I try to design a bunch of stuff where you would kind of hide the module-specific stuff in some function below. And so I could just write generic code at a level without because that you'd hit some pieces of the code where it would be brutal. You'd have like interleaved macros, like feature macros, and and like if statements. And so like you'd have you'd have if, but then inside the the block of the if you'd have the different you know macros because you'd have different settings and it would it was it could very quickly get unwieldy, if that's the correct word. Anyway, so yeah. But I mean, used in judiciously, they can be very useful. Yeah. Yeah. I guess you could say that about a lot of language features though. You know, if you use it use it prudently and it's great, but you can always abuse some language feature and and yes.

Ben

Maybe especially when it comes to C. Yeah. And you know, C is famous for being a large language and having dark corners and everyone using a sort of slightly different subset of that language according to policy. Yeah. But you know, like Kate said, it's complicated. Did you did you see that talk of hers? It's from now it's all it's from pre-pandemic, so it's old now, I guess. But she said in that talk, yeah, it's complicated. Yeah, you you do have to know how your language works. And in a sense, there is no royal road to to knowing C. You just you'd have to know the language. Yeah. And the libraries. Yeah.

Conor

I can't remember who said it, but I mean, I'm sure several people have, but there's essentially like seven different languages within C.

Ben

Oh, yeah, in terms of like Turing completeness, they might set maybe we're up to seven now.

Conor

Yeah. But yes. Plus or minus. And I can't I can't remember what podcast I was listening to recently. It might have been the Haskell podcast or the Haskell something. And they were talking about Turing complete languages and like the type system and how that's just like a terrible idea. And yes, there are like they didn't refer to C by name, but they said like the fact that it exists and you can do powerful things with it does not make it like a good thing. And there are better alternatives where you aren't, you know, computing factorials at compile time in this kind of sure. Anyways, and and uh they they didn't mention mention C, and I was like, I know what language you're talking about.

Ben

I kind of agree, but also, you know, as as a professional C library writer, that stuff is really useful. But I sort of agree in a platonic sense, you know, if you have if your language is turing complete, you know, and I gave a lightning talk about this, what you what you're saying is it's fine for my language to have foot guns, right? Infinite recursion. Turing completeness means effectively infinite recursion is is okay. You know, you get one of the ways you get Turing completeness is through self-reference, right? And so that opens the door to infinite loops, infinite recursion, etc. Whereas if you have a type system which cannot express that kind of self-reference, you still have a nice structural type system. You still can do iteration, recursion, you just can't make it unbounded. So you get some kind of guarantees. Right.

Conor

It's I'm of two minds about it. I remember I I won't remember his name, but when I was in California, I was at a meetup and there was a guy working at Facebook or Meta, I guess now. At the time I think it was Facebook, and he said when he codes on his own, he codes in C because he doesn't have to worry about other people because he knows what he's doing. But he's like, as a manager of a team, I prefer Rust because I can sleep better at night and there's less for me to worry about. He's like, I still prefer personally C because I have more freedom and I trust myself. But when I'm managing a team, I would prefer the th the language that comes with more guardrails. It doesn't mean I I'm gonna sleep perfectly at night. I still have stuff to worry about, but out of the box, it's I think for a team that consists of newer programmers and some, I'm sure, more experienced. But and uh that's always stuck with me of him saying that he actually prefers C, but not as a manager. Right. C plus plus 26 and 29. Do you I I haven't heard anything about 29. Do you do you have you heard anyone?

Ben

The only thing I've heard was recently Atheus posting about the possibility of targeting the unit's library for C29. Oh, okay.

Conor

That's the amalgamation. I know they put together like they united all the different factions of unit libraries and tried to bring them together to have one.

Ben

It is a surprisingly complex space. There are many, many use cases. And most people have some idea about what they think a unit's library needs to support. But I I think for most people, certainly for me, you know, actually finding out about uh metrology, I think it is. I've never heard of that. It's it's the science of measurement, right? So there's all kinds of use cases that you know aren't obvious unless you start looking into these things. And yeah, the MP Units library supports a lot of things. A lot of things.

Conor

Yeah, I remember I remember when I went to committee meetings seeing him present a few times, and yeah, it's surprisingly deep space that is like an iceberg that you know you see a couple examples and you're like, oh yeah, I get what that's for, and then you see the iceberg that's underneath. And there's a whole I can't remember if it's SI or there's like a there's there's some like ISO community or some body of that is deemed seven different things as like standard whatever.

Ben

Oh yeah, the the standard the SI units system in the SR. It's the yeah, and and so you you learned this in high school physics, right? Maybe. I don't know. I only I only took physics. This is like the kilogram, the meter, the second, the amp, I think is in there. There's those are the the base, yeah, the base units, which are the amp is the strange one you you you think it's strange because it's coulombs per second, right? You think you might think that charge is the basic quantity, and so coulomb would be the basic unit. But in the SI it's actually the amp.

Conor

You've retained more from physics than I did, that's for sure. Okay, so that's C. I mean, I feel like uh we at some point we should bring someone who's still attending meetings meetings. Uh I know I know maybe Barry Barry is the most prolific author of papers and doer of things that's been interviewed in the past.

Ben

Barry's certainly given good talks about reflection. Has he?

Conor

I actually don't the last Barry Revson talk I've seen, I want to say, was the like Ranges comparison one. Because he doesn't he doesn't speak often. I think that actually was like the first talk that I've seen him give.

Ben

He's been speaking He's been speaking more these last few years, I think. He certainly he gave Reflection Talk, which was very good at CPPCon. I think he recently repeated that talk or updated that talk for the Chicago meetup, and he's giving the opening keynote of C now, which I think which is also about reflection, I believe.

Conor

Okay, well, so yeah, I uh I've I've Googled, Googled, I've YouTube Barry Revzin, and the top two talks are the one that I mentioned, Iterators and ranges, which compare C to D to Rust. And inside of it, he also mentions Java and Python. Right. He gave that a couple times, but the top one got posted one month ago. So there you go, YouTube. Sometimes you do well, sometimes you do poorly. You did not recommend Barry's talk to me, and it's called Practical Reflection with C26. So we will link it in the show notes and I will put it on my list of talks to watch. That's the problem. I always whine about how they they've now trying to pander to the algorithm, so they they bleed these things out for so long. And I used to just like they used to just drop them all at once, and I would go and pick, create my own little playlist, and then I'd watch them all like back to back to back. But now whenever we mention these, half the time I go and add it to the show notes, and then it has to be unlinked. It's not it's not out yet, but I will go and update that. Alright, so that's like a mini C26, 29. I mean, uh are there other things like it's you those are the three that you've mentioned, but well, reflection is the big ticket item that most people are waiting for. I I heard that one of the compilers had implemented already.

Ben

That's right. Sorry. The GCC has the first implementation already emerged. Yeah, yeah. For about a month or so now. So I guess you it sounded like you were using Clang because the Clang reflection fork has been on Compiler Explorer for a while now. And so when you see oftentimes when you see examples, there'll be links using that.

Conor

Okay.

Ben

And so you're I guess just waiting for that to be Well, uh I won't be using reflection for a while yet in my day job. It is exciting. Well but when I'm when I'm finding More excited about in the sense of being able to use it now and having been using it for the last couple of years is senders and receivers. Which is which is not not admittedly the standard version, but you know, my implementation.

Conor

And are you gonna are there's is there gonna be some big change that's gonna switch when that's available to you? Because I know that you have your implementation. Are you gonna be able to like merge the two somehow?

Ben

Or well so I don't think that is I so that's not beyond the realm of possibility, but I don't think it's maybe going to be worth it for a while. Because, you know, my implementation targets bare metal microcontrollers, targets zero exception, zero allocation environments. Now, the standard version is fairly zero, pretty much zero allocation if you want that. But zero exception is the standard version, obviously, plays nicely with exceptions. And whether or not you think exceptions are you know well performing or whatever, the fact is they just a lot of bare metal, particularly bare metal things, just do not use exceptions right now.

Conor

But you said so it's not wouldn't be worth it now. Would there be something that occurs in the future that would make it worth it? Or you're just saying for now and the future is untold?

Ben

The future is untold, but I'm thinking as far as like abandoning my implementation and switching entirely to the standard, probably that's a long way in the future. Just because the way standardization works, it tends to be fairly conservative. Like what's coming into the standard with C26 is not the full set of algorithms, for example. It's a good basis set, but there are some algorithms that aren't there. And also there are ways in which my implementation has diverged from some of the standard ideas. What's important to me is more that the ideas behind state execution are sound. And I've I've used those as inspiration. And I've used, you know, some of the standard naming I've I've copied, but but in many ways I'm living in a much simpler world than the standard needs to deal with. So that makes it correspondingly easier.

Conor

Well, I mean it's exciting nonetheless, and it's always there's always new talks that are coming out. I mean, the reflection ones have already been being given. And I guess actually the senders and receivers one. There's a ton of talks like that out there.

Ben

There's quite a few now. From I've did I did one, Eric did some, Steve Downey has done some, I think.

Conor

So actually, I guess maybe it's going to be the C29.

Ben

Everyone's everyone's giving talks that are uh targeting the Michael Case gave a really good talk at CPPCon about asynchronous handling of special function registers, I think was the title.

Conor

I'll go collect them. I mean half of those or more have already been linked in past episodes, but I will go collect them and uh put them in ones or in this episode. So and hopefully they're all out by now. I know the C now ones are out for sure, and the ones that you've given. CPPCon.

Ben

And the CPPCon ones are starting to, or at least I think more than starting to. Most most of them are now public.

Conor

Although I haven't gone back, and that'll be a today later today exercise. I'll go and check to see which links that aren't linked that can be linked and update that. Be sure to check these show notes either in your podcast app or at adspthepodcast.com for links to anything we mentioned in today's episode, as well as a link to a GitHub discussion where you can leave thoughts, comments, and questions. Thanks for listening. We hope you enjoyed and have a great day. I am the anti Bryce. Um