D pointers
    George Staikos 
    staikos at kde.org
       
    Mon Oct  3 22:28:37 BST 2005
    
    
  
On Monday 03 October 2005 16:55, Michael Pyne wrote:
> On Monday 03 October 2005 12:11, George Staikos wrote:
> > On Monday 03 October 2005 05:47, Simon Hausmann wrote:
> > > Besides that it probably doesn't hurt for integers and other primitive
> > > types, but if you have more complex types you still waste constructor
> > > and destructor time on them even if they're unused.
> >
> >    You can replace them with POD filler.
>
> How do you ensure that the POD filler is always the same size as the object
> being replaced on all platforms though?
 Here's an example from KApplication:
  struct oldPixmapType { QPixmap a, b; };
  mutable union {
    struct {
      QPixmap *icon, *miniIcon;
    } pm;
    char unused[sizeof(oldPixmapType)];
  } aIconPixmap; // KDE4: remove me
  Here we were even able to reuse the space so we didn't need to add to the 
d-pointer.
-- 
George Staikos
KDE Developer				http://www.kde.org/
Staikos Computing Services Inc.		http://www.staikos.net/
    
    
More information about the kde-core-devel
mailing list