[Kst] [Bug 91692] new tool: compare with file...

George Staikos staikos at kde.org
Fri Jun 24 04:05:50 CEST 2005


------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=91692         




------- Additional Comments From staikos kde org  2005-06-24 04:05 -------
On Thursday 23 June 2005 20:48, Rick Chern wrote:
> 02:47 ------- Going to implement copy constructors for all data objects
> (unless there is a better way?)


  It seems to make sense but I'm not convinced of the usage pattern.  It 
requires something to the effect of:

KstDataObjectFooPtr x = new KstDataObjectFoo(*fooToCopy);

  I'm thinking it would be clearer to have:

KstDataObjectFooPtr x = fooToCopy->duplicate();

  would be better.  Several reasons:

1) Implementing the copy constructor basically means we have to implement the 
assignment operator, otherwise we get inconsistent behavior.
2) The copy constructor has to copy -everything-, whereas duplicate() can be 
defined to create a new object and populate it only with what is needed.
3) Shared objects are really pointers, so using them by value and copying is 
really unusual and potentially dangerous.
4) The idea of implicit copies of these things really scares me.  I actually 
think we should explicitly disable the copy constructor for safety reasons in 
KstObject.

   I think the new dependents functions you mentioned are fine, but they 
probably don't need to be virtual.  I'm going to do a virtual table cleanup 
at some point because we have too many we don't need and it's making things 
big and slow.  If they absolutely need to be virtual though, go ahead.  I 
might have missed something...


More information about the Kst mailing list