News for hackers. Stuff that matters.
Re:C/C++ Pointer Declaration Syntax – It makes sense by jhrobert on Tuesday February 21, 2012 @04:26AM (#3615834)
Nice point. Yet...

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.

Re:C/C++ Pointer Declaration Syntax – It makes sense by dkersten on Tuesday February 21, 2012 @05:47AM (#3616012)
It makes sense, but I still don't like it as its error prone.

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)

Re:C/C++ Pointer Declaration Syntax – It makes sense by ochs on Tuesday February 21, 2012 @08:57AM (#3616419)
It makes no sense for references at all. But references are of course C++, so blame Stroustrup.
Re:C/C++ Pointer Declaration Syntax – It makes sense by eru on Tuesday February 21, 2012 @06:32AM (#3616134)
Which meaning of `auto' do you use there?
Re:C/C++ Pointer Declaration Syntax – It makes sense by ehamberg on Tuesday February 21, 2012 @09:06AM (#3616442)
In C++11 you can use ‘auto’ when defining a variable and the compiler will figure out its type for you.
Re:C/C++ Pointer Declaration Syntax – It makes sense by eru on Tuesday February 21, 2012 @09:57AM (#3616635)
Thanks. Your use of `actually' made me think that you were using `auto' in the old sense just to make grepping easier.
Re:C/C++ Pointer Declaration Syntax – It makes sense by slowpoke on Tuesday February 21, 2012 @09:44AM (#3616589)
Also known as Type Inference, if you want/need a keyword for further reading.