What to do about dpointers
apaku at gmx.de
Fri May 18 19:43:31 BST 2007
On 18.05.07 09:19:29, Allen Winter wrote:
> On Friday 18 May 2007 7:37:34 am David Faure wrote:
> > On Friday 18 May 2007, Andreas Pakulat wrote:
> > > Hi,
> > >
> > > I'd like to know what do you kdelibs people do wrt to classes that don't
> > > have private members (at the moment) and no dpointer? Do you add a
> > > dpointer and private class and just initialize the dpointer to 0? Whats
> > > the common practice for this?
> > Assuming this is about exported and installed classes only,
> > the common practice would be to add a d pointer and move all member vars
> > into it (the krazy check warns about a lack of d pointers, but also about member
> > variables). Exceptions would be if some public method needs to be inline for
> > speed reasons but that's probably not the case in kdelibs (as it is in e.g. QString).
Thats what I already knew, I guess I didn't explain myself well enough.
There are some cases where I have an exported class in an installed
header which doesn't have any private members at the moment. The
question was: what is done for example in kdelibs in this case, is a
dpointer created nevertheless?
> But, even if your class doesn't have any private members it is still
> good practice to give it a const dpointer and initialize it to 0.
So that is done in kdelibs as well? I'm just wanting to find out whats
done in the library module (without having to look through it manually)
You're not my type. For that matter, you're not even my species!!!
More information about the kde-core-devel