const ref returns in KDE3 compat code / other questions
David Faure
faure at kde.org
Thu May 10 09:56:48 BST 2007
On Thursday 10 May 2007, Alex Merry wrote:
> KGlobal: There are two functions returning const refs. I think they
> probably should do so, but I'd like someone with a bit more experience
> check before I exclude it.
Yes mainComponent() has to return a ref otherwise the refcounts are messed up,
as per a previous discussion. The other one (activeComponent) could be fixed to
return by value.
> sonnet/loader.h: Most of the members of this class are in the d-pointer,
> except one that is marked mutable. I assume this is for a reason, but
> I'm not sure what.
I'm sure it can move to the d pointer. Which even removes the need for mutable.
> config/ksharedconfig.h: I wasn't sure whether these should have
> d-pointers or not. KSharedConfigPtr is possibly too simple, and the
> global list and shared part of KSharedConfig meant I wasn't sure what
> to do about it.
They are only refcounting, I can't see the need for additional data there
(any additional feature would be in KConfig anyway).
> io/kurl.h: Does KUrl::List need a d-pointer? It's just some convenience
> methods on top of a QList, but I guess it's possible a method might
> need to store some data in the future...
I really don't see this ever happening... I wouldn't put a d pointer in KUrl::List.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list