On 10/27/2026 6:43 PM, Lawrence D’Oliveiro wrote:
> On Tue, 27 Oct 2026 21:35:09 -0400, James Kuyper wrote: >
>> ... without the context that applies elsewhere, your comment about >> resource allocation comes off as a non-sequitur.
> > That’s just an excuse. Other comments of mine, from further back in > this particular line of this thread: > > * “What if you’re building an object that needs to be returned to the > caller?” > * “The principle applies to Fortran as it does to any language where > you have to explicitly manage storage allocations.” > * “If you have to do cleanup at each level before exiting, then it works > perfectly well.” > > Did you notice any of that? > > From elsewhere in the discussion: > > I find the C code I write tends to do a lot of dynamic resource > allocations. These can sometimes fail with errors. So error > recovery will invariably involve cleaning up those parts of the > allocations which already succeeded. Gotos are no good for this; > you need to exit levels of structure nesting one by one, disposing > of allocations as you go. > > I put together an example here > <https://gitlab.com/ldo/a_structured_discipline_of_programming>. > This is an extension module that offers services to Python code, > because that is just about the worst example I could think of, for > those who think gotos can cut it. > > Did you pay attention to any of that?
Its actually pretty simple. There are libs out there that allow the caller to create the memory it needs. io_uring is just one of them. DirectX12 is another. The user creates all the memory, aligns it, etc, and can update a single frame with a single memcpy.