Hacker News new | past | comments | ask | show | jobs | submit login

Caller provided objects are a standard idiom that offers greater flexibility to use static/global vars, objects with a FAM, and custom allocators.



I was more thinking about the combination of caller provided object and callee returning a pointer (in this case to the same object).

But I suppose it decouples "call time" resources from "return time" resources (the current api does not guarantee that the result will be in caller's "out", just that a buffer will be returned that the caller owns and have to de-allocate/manage).


That's a common (I wouldn't necessarily call it "standard") C idiom, to allow chaining calls. You could e.g. do

  puts(reverse(fwdbuf, reverse(revbuf, input)));




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: