tags:

views:

118

answers:

1

Possible Duplicate:
C++: Asterisks and Pointers

First of, excuses if this is a duplicate, it was kind of hard to find any results using the search so I assume it hasn't been asked yet (which I don't believe)

As it appears, there's two different pointer (and for C++: reference) declaration conventions. Some people prefer to use

// Convention #1
T* pointer;
T& reference;

and other people prefer

// Convention #2
T *pointer;
T &reference;

For me coming from a C background about to learn C++, it seems as "we C people" prefer convention #2, and C++ people prefer convention #1.

In my opinion, #2 makes more sense when declaring multiple variables in one line:

T *ptr1, *ptr2  // sense!
T* ptr1, *ptr2  // looks... strange

Now since this is a subjective topic, I can't hope for a definite answer, but I'd like to collect some opinions (and reasons!) why a particular convention is preferred and why C and C++ differ :)

A: 

It's just a matter of preference.. as every duplicate on SO states :)

Jack