lua-users home
lua-l archive

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


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)
{
  // do something with a and b...
}

void foo_do_something (foo *r, foo *a, foo *b)
{
  foo_copy_to(r, a);
  foo_do_something_d(r, b);
}

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