[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: object-model: Return by value, reference or pointer? (or something else?)

From: Steinar Bang <sb_at_dod.no>
Date: Wed, 13 Oct 2010 18:51:23 +0200

>>>>> "Hyrum K. Wright" <hyrum_wright_at_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?

Generally 1 gives a nicer API. But if you have any inheritance and
virtual methods going, then 2 is simplest.
Received on 2010-10-13 18:52:15 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.