1) Pointer* variable;
2) Pointer *variable;
When I started programming I used number 2, for some years now I use number 1, which I think its more explicit.
So, I was just curious where did you guys put it!
EDIT: I Added the two missing options...

How is that not "type then variable"? The string and pointer are still on the left, therefore type is before the variable. It's not string ptr*This declares... what? It's type information has been moved to its variable. No more clear rule: type then variable.
Code: Select all
int** * *** * *** *ptr;
Code: Select all
string str;
string *pstr;
string **ppstr;
Code: Select all
string* *ppstr;

Code: Select all
const type&
void myClass::functionName() const;Code: Select all
void myClass::const functionName();
Agreed. (not necessarily on the const before the function name, because imho that looks weird, but on the point in generalbetajaen wrote:I like C++, but it should be more rigid in design.

Code: Select all
class aClass
{
public:
const Ogre::Vector3 const getPosition();
};
Code: Select all
Ogre::Vector3 const getPosition() const;
Code: Select all
Ogre::Vector3 const getPosition();
That is only a problem if the position of the const is not uniquebetajaen wrote:Thing is then; If you can do this:
Which is const the getPosition or the Vector3? Not from a C++ point of view, but a more generic one. Which one is const?Code: Select all
Ogre::Vector3 const getPosition();

Breaking compatibility with the way C has done variable declaration for 38 years just because some C++ coders don't like a space on the left of an asterisk is a bit extreme. The whitespace has no meaning, so it shouldn't be an error to include it.After many years of C++ programming, it's very inconsistent to me. I don't think there should be any whitespace between the * and type. Because the * indicates the type. I would go as far as saying, unless it's in a list it should be syntax error to have it any other way.
Code: Select all
int* const a;
int *const a;
int*const a;
int * const a;Code: Select all
int *var;
const int *var;
int *const var;
const int *const var;Code: Select all
int* someFunc() { ... }
const int* someFunc() { ... }Code: Select all
int *SomeClass::someFunc() { ... }
Code: Select all
LongClassNameBlarg* view;
ShortCName* t_bar;
int index;
Code: Select all
LongClassNameBlarg *view;
ShortCName *t_bar;
int index;
Code: Select all
Ogre::Root* r = createNewRoot();
Ogre::RenderSystem* rsys = r->getRenderSystemByName( qName.toStdString() );
Code: Select all
rangeSpinBox->setValue ( d->dat->attenuation_params[0] );
constantDoubleSpinBox->setValue ( d->dat->attenuation_params[1] );
linearDoubleSpinBox->setValue ( d->dat->attenuation_params[2] );
quadraticDoubleSpinBox->setValue( d->dat->attenuation_params[3] );
...
setItemWidget(i, 1, typesComboBox );
setItemWidget(i, 2, editDiffuseColorButton );
setItemWidget(i, 3, editSpecularColorButton );
setItemWidget(i, 4, editParamsButton );
...
QMap<QString, QComboBox*> pairs = localLaunchDialog->getPairs(qName);
QMap<QString, QComboBox*>::iterator it = pairs.begin();
...
if(localLaunchDialog) delete localLaunchDialog;
if(localGridDialog) delete localGridDialog;
if(log_dock) delete log_dock;
...

Just couldn't decide, eh?lingfors wrote:Pointer * variable;

Bah, (g)vim has had those features for years. Except for the 'minimap' - but that's what taglist is for (at least you can see the text). And with python/vimscript and text-piping through perl or whatever you can do anything.

lingfors wrote:Pointer * variable;
Code: Select all
int* pointerToInt;