lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 5/5/23 19:30, siiky wrote:
I recently had this exact problem in a C library I'm working on. In the end I went with something like the following:


// `d` for "destructive"
void foo_do_something_d (foo *a, foo *b)
...
void foo_do_something (foo *r, foo *a, foo *b)
...

I see this as the explicit out parameter case, but instead of testing for *b==null inside foo_do_something you separated that case in a call with different signature *and* name.


(Didn't reply to the list by mistake, sorry for the duplicate, Jorge)

No problem, I did the same in this thread in m two first responses :\


Jorge