Whenever I write I library I don't allocate memory. If memory needs to be allocated, the program calling into the library allocates memory and passes a pointer (or reference I suppose) into the library call.
Clearly this can't be enforced, but I've always found it bad practice to allocate memory inside a library.
Whenever I write I library I don't allocate memory. If memory needs to be allocated, the program calling into the library allocates memory and passes a pointer (or reference I suppose) into the library call.
Clearly this can't be enforced, but I've always found it bad practice to allocate memory inside a library.