by jhrobert · 14y ago · 0 comments
What about "references"? int& a, b; or int &a, &b; ?
So, I think that I'll stick to int* pa; int* pb;
i.e. one variable per line.
Additionnaly it makes it easier too lookup for a variable's type when reading the source code because one does not need to walk thru a list to find the variable, it is always after the type. I actually use "auto" to make it even easier to find variable declarations, going as far as grouping such declarations to some extend to make them easier to find.
Styles vary.
It does make sense that the dereferenced pf is a float, but that doesn't stop it from being confusing. Being a pointer is, to me, part of the type. A pointer is a type after all, so having the * bind to the type would make a lot more sense to me.
Additionnaly it makes it easier too lookup for a variable's type when reading
It would also be easier to grep for types too (not that I've ever found myself doing that, but I'm sure people occasionally do)