cString operator= with same buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
buffer.

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


[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux