[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 22:05:44 +0200

>>>>> "Hyrum K. Wright" <hyrum_wright_at_mail.utexas.edu>:

> This is an interesting approach...and parallels what has already been
> done. :)

> Out of curiosity, have you taken a chance to look at the
> existing code here:
> http://svn.apache.org/repos/asf/subversion/branches/object-model/subversion/bindings/c++/include/Types.h
> ?

Looking at it now.

> Of particular interest are the RefCounter and CStructWrapper classes.

Hm... personally I would have gone for a non-templatized solution. More
classes (the classes I spelled out, you create by instantiating
templates), perhaps, and more code. But IMO higher readability.

But it's a personal choice thing, and not an argument against.

I'm divided on whether I would move the delete of the RefCounter object
into the dec_ref method, or leave it where it is. On one hand it feels
like good encapsulation to put it together with the dec_ref, on the
other hand, I've always been wary of "delete this;"...

So leaving the delete where it is is probably a good choice. :-)

Other than that it looks good to me (with the caveat that I haven't
actually tried using it, and that's when you know whether an API is good
or not).
Received on 2010-10-13 22:06:38 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.