Hi Jason, in my opinion this is correct and that's the way I'm coding :-)
Putting the asterisk to the variable is the correct way to use because it doesn't lead to misunderstanding and it's the way the compiler interprets it e.g. Wrong: QString* pVar1, pVar2; // second var is no pointer from the compiler's point of view Correct: QString *pVar1, *pVar2; Defining a return type like in your function is a different thing. The asterisk belongs to the type and not to the function. e.g. QString* foo(); In my opinion the first line in your samples are correct. On Sunday 31 August 2008 15:25:47 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"? > > 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 -- mit freundlichen Grüßen / best regards Gerhard Gappmeier ascolab GmbH - automation systems communication laboratory Tel.: +49 9131 691 123 Fax: +49 9131 691 128 Web: http://www.ascolab.com GPG-Key: http://www.ascolab.com/gpg/gg.asc
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Plasma-devel mailing list [email protected] https://mail.kde.org/mailman/listinfo/plasma-devel
