D pointers

Cornelius Schumacher schumacher at kde.org
Mon Oct 3 10:43:55 BST 2005

On Monday 03 October 2005 08:19, Lars Knoll wrote:
> On Sunday 02 October 2005 18:57, Cornelius Schumacher wrote:
> >
> > But if the policy is "Move all private members to private classes" I
> > would object, because this thread shows that there are no clear benefits
> > and it is more a question of personal coding style.
> The benefit is the greater refactoring possibilities you have. I can only
> say that from past 5 years of coding in Qt I have missed this possibility
> quite a few times just because a member happened to be in the class and not
> the d pointer.

But if you need different private variables for a refactoring you can always 
create them in the private class. The worst thing that can happen is that you 
have unused variables in the class. If that is uglier than having to write 
"d->someVariable" and having to take care of destructors, copy constructors, 
assignment operators, instead of simply using "mSomeVariable" is basically a 
matter of taste, I would say, and so a bad subject for a policy.

Cornelius Schumacher <schumacher at kde.org>

More information about the kde-core-devel mailing list