On Wed, Oct 13, 2010 at 11:51 AM, Steinar Bang <s...@dod.no> wrote:
>>>>>> "Hyrum K. Wright" <hyrum_wri...@mail.utexas.edu>:
>
>> 2) Return everything by pointer
>>    Pros: can represent the NULL value, potentially less memory overhead
>>    Cons: more complex memory management (caller must delete returned value)
>
> Um... why must the caller delete the returned value?  I thought you were
> using refcounting smartpointers?

Refcounting smartpointers are used to avoid duplication of the
underlying C structures, but they are completely private.  I've got
serious reservations about exposing that complexity in the external
object interfaces.  Given those reservations, the API would just
return a vanilla pointer, which leaves the caller the responsibility
of freeing it.

> Generally 1 gives a nicer API.  But if you have any inheritance and
> virtual methods going, then 2 is simplest.

No inheritance or virtual stuff, as of yet, so not a concern.

-Hyrum

Reply via email to