[vdr] Re: cString operator= with same buffer

Jon Burgess jburgess at uklinux.net
Sun Nov 20 22:07:22 CET 2005


Sascha Volkenandt wrote:
> Would you mind to explain how you get two strings pointing to the same buffer 
> after the copy ctor is safe (makes a copy instead of taking the buffer)? IMHO 
> the copy ctor already takes care that doesn't happen (except if you hand over 
> the same buffer to two cStrings with TakePointer = true, which is IMHO not 
> intended).

As you say, all normal usage should be between 2 different buffers. It 
doesn't seem legal to me that 2 cStings would share the same buffer. 
This would always cause things to blow up when the destructors are called.

The only way that I can come up with is to assign a cString to itself 
(as per my example main.c elsewhere in this thread). I imagine this 
could happen legally under some limited circumstances.

I don't know the details of the scenario seen by Holger.

	Jon



More information about the vdr mailing list