Clearly I haven't gotten enough of my 🍑 kicked by the standards process. So, here we go, doing Big Work all over again. The first of many larger changes for C that should've been done 25 years ago, since the days of __try/__finally.

Let's get it done. ⤵

The Defer Technical Specification: It Is Time | Björkus Dorkus | The Pasture | https://thephd.dev/c2y-the-defer-technical-specification-its-time-go-go-go

The Defer Technical Specification: It Is Time

After the Graz, Austria February 2025 WG14 Meeting, I am now confident in the final status of the defer TS, and it is now time.

The Pasture

Article EDIT:

I gave Yodaiken's code too much credit. He actually made the defer version in the proposal worse, lol (loop resources are not properly freed on every go-around, which the defer proposal version fixed). Which is actually a DOWNGRADE from the original source code (that the defer proposal was improving on) too, lmfao.

@thephd that sounds like a perfect counter parry-argument, amazing!

@thephd doesn't it use-after-free everywhere goes like:

freeall(&x);
return h_err_from_errno(errno, x.outpluginsdirphp);

but it seems like he original does also so i must be missing something idk.

but the point about defer running after the return expression is evaluated seemed notable to me as the error is created before resources are freed

@sqwishy I think (thought?) h_err_from_errno is a macro and that the second parameter isn't used "like that" (directly, I thought it just used it as a name and stringized).