On 10/22/2026 10:29 PM, Chris M. Thomasson wrote:
> On 10/22/2026 8:19 PM, Lawrence D’Oliveiro wrote:
>> On Thu, 22 Oct 2026 07:26:21 -0700, Peter Flass wrote:
>>
>>> That's why I try to use PL/I AUTOMATIC (stack) storage and not
>>> allocate a lot of stuff. You need to have a disciplined approach if
>>> you allocate random stuff here and there.
>>
>> What if you’re building an object that needs to be returned to the
>> caller?
>
> Have the caller have the object before hand and call a function to initialize it?
Even analogous, to say, an API that says read n bytes and store into buffer. Well, the caller has lifetime of said buffer. The caller makes the buffer, calls into the function. The buffer bounds are known. Say a metadata stub:
struct foobar_caller_alloc_helper
{
size_t m_size;
size_t m_align;
};