
17 Jul
2004
17 Jul
'04
5:16 a.m.
On Sat, 2004-07-17 at 01:07, Jon A. Cruz wrote:
MenTaLguY wrote:
The one gotcha with copy constructors is that the default does a bitwise copy. Often that's a very dangerous thing, as anything that 'owns' pointers gets duplicates and you get fun things like double-deletes.
Yes, "disabling" copy constructors is generally wise unless you know you'll need them (for non-trivial classes it's important to think through what "copy" actually _means_ beforehand).
But in the case of a mostly POD struct where pointer ownership is extrinsic (as in this case), it's better to let the compiler do its thing, IMO.
Of course, pointer ownership is much less of an issue when you are using a garbage collector anyhow.
-mental