[vdr] cString operator= with same buffer

Holger Brunn holger.brunn at stud.uni-karlsruhe.de
Fri Nov 18 19:48:25 CET 2005

Hello list,

I'm wondering what should happen when assigning a cString to another where
both have pointers to the same buffer? As of version 1.3.36, we first free
it and duplicate it afterwards.

That surely isn't intended, but how to deal with this?

1) Leave them pointing to the same buffer after operator=
2) Don't free the buffer, but duplicate it (that happens in vdr<1.3.36)

Do you see good arguments for 1)? I only have one for 2), as you (I) expect
to receive a new copy of cString's buffer you assinged from. And this
cString's destructor will take care about freeing memory of the original

Thanks for your comments,
(who feels ashamed to start a discussion about a one-line-patch :-)

More information about the vdr mailing list