plasma/kdelibs coding style and pointers

Jason Stubbs jasonbstubbs at gmail.com
Sun Aug 31 15:25:47 CEST 2008


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"?

QString *p;
QString* p;

void foo(QString *p);
void foo(QString* p);

void foo(QString*);
void foo(QString *);

Blah* const d;
Blah *const d;
Blah * const d;

QList<Blah*> foo;
QList<Blah *> foo;

QString* Blah::foo();
QString *Blah::foo();
QString * Blah::foo();

Assuming the above are all correct, is it "correct" to put the asterisk 
next to the variable (but not function) name when one is present and 
next to the class/struct name otherwise?


[1] http://techbase.kde.org/Policies/Kdelibs_Coding_Style

-- 
Jason Stubbs


More information about the Plasma-devel mailing list