I posted "writing C for #curl" just a short while ago, which is relevant to the recent "C mistake" graphs.

https://daniel.haxx.se/blog/2025/04/07/writing-c-for-curl/

Writing C for curl

It is a somewhat common question to me: how do we write C in curl to make it safe and secure for billions of installations? Some precautions we take and decisions we make. There is no silver bullet, just guidelines. As I think you can see for yourself below they are also neither strange nor … Continue reading Writing C for curl →

daniel.haxx.se
@bagder (whispers "rust ...")
@otte_homan I have the book already
@bagder hehe. Look to be fair I've started trying rust. Seems doable.
@otte_homan can you return error on out of memory yet?
@bagder not yet, but rust updates come at a faster pace than curl updates, so there's that. It won't be long.
@otte_homan coincidentally, that is exactly what I was told in 2020...
@bagder might be a good argument to bite the bullet and sign up and contribute, if you know where all the pinch points are ... no?
@otte_homan you expect a complete outsider and rookie to be able to help the Rust core team fix something they have themselves not been able to, as a little side-gig next to everything else I do? Yeah, "sure".
@bagder I'm not "expecting" anything mate. You seem to have a huge impression of yourself, terribly terribly busy etc. saving the world, and so on. Calm down a bit. Have a beer, a pizza, some aquavit. Geez. (go on, block me, if you dare).
It's more of a language design & legacy problem I think, Rust was based on functional programming languages where memory gets managed for you magically. By now they can't throw out the old APIs, so a rusty cURL would need something like linter rules to avoid using, eg, vec.push(something) and instead use something like if let Err(x) = vec.push_within_capacity(x) { vec.try_reserve(...)?; let _ = vec.push_within_capacity(x) }, hopefully in a wrapper function, but also note that push_within_capacity is currently an experimental feature. And you'd have to add such checks for every thing that might allocate on heap.

CC: @bagder@mastodon.social