plasma/kdelibs coding style and pointers

Jason Stubbs jasonbstubbs at gmail.com
Mon Sep 1 15:08:27 CEST 2008


Jason Stubbs wrote:
> The kdelibs coding style on techbase[1] only says "For pointers or 
> references, use a single space before '*' or '&', but not after". When 
> looking through applet.h and applet.cpp, I see this rule being broken in 
> some circumstances. Am I right to believe that the first in each of the 
> following groups is "correct"?

The '&' case seems to be more tricky. In applet.cpp, I see:

const QString &category
const QString& reason
const QSizeF & constraint
KConfigGroup &group

All of the above are used in function declarations. Obtaining a pointer 
to a stack-based object and the like is always written &obj though.

Hmm, I'm also seeing both:

QWidget *w =
Applet* applet =

I hate people not using my preferred coding style, but I hate a mix of 
coding styles within a single code base much much more. ;)

I'm wanting to standardize the coding style in the playground systray 
applet, but judging by the above (which are all from applet.cpp in 
libs/plasma) it seems that it's perhaps not worth the effort?

--
Jason Stubbs


More information about the Plasma-devel mailing list