[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: Branko Čibej <brane_at_xbc.nu>
Date: Fri, 15 Oct 2010 11:28:47 +0200

 On 14.10.2010 21:32, Steinar Bang wrote:
>>>>>> Branko Čibej <brane_at_xbc.nu>:
>> All right. Then derive svn::string from std::string, and add a .null()
>> method. You get to use all the standard string alogorithm
>> specializations, plus you get what you want.
> There is one known objection to this: std::string doesn't have a virtual
> destructor, so if you hand a pointer to your derived string off to
> something that holds a std::string* and then do delete on that
> std::string* you enter into "undefined behaviour" territory.
>
> Meaning what happens isn't defined, and different compilers can
> do... interesting things.

std::string also doesn't have any virtual functions, nor does a bool
member require a destructor. Memory deallocation is OK. std::string is
actually a POD and tricky rules apply that allow you do do this safely,
IIRC ...

-- Brane
Received on 2010-10-15 11:29:30 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.