On 10/26/2026 3:20 PM, Lawrence D’Oliveiro wrote:
> On Mon, 26 Oct 2026 14:53:48 -0700, Chris M. Thomasson wrote: >
>> On 10/26/2026 2:45 PM, Lawrence D’Oliveiro wrote:
>>> >>> On Mon, 26 Oct 2026 13:33:37 -0700, Chris M. Thomasson wrote: >>>
>>>> Say a lib that has foo_create... Well, the damn called must >>>> remember to call foo_destroy, right?
>>> >>> Are you backpedalling from your previous idea that the caller must >>> allocate the memory for the library to use?
>> >> Where did I say must?
> > You said “Managing the memory is the caller’s job in C anyway.” You > didn’t say “could be the caller’s job” as in “the caller could have a > choice”, you said “*is* the caller’s job”. No choice. I.e. the caller > *must* manage memory.
But, the caller must take care in C. Say a lib that allows the caller to create their own memory from the requirements reaped from the lib. Okay. Fine. Also, take a lib that is more "encapsulated" than say a pure foo_create/destroy. The caller must remember to call foo_destroy, right? Using io_uring is a fun one. The caller created the memory, iirc from mmap, so the kernel can use it. The Kernel punts off the lifetime management of the users ring buffers. The C must manage things regardless. say malloc and free?