On 09/14/2005 04:46 AM, Dave Korn wrote:
[snip]
IMO (and this is a _very_ IMO subject, so I acknowledge in advance that
there is no one true way and that I may feel so but other people may feel
differently), the argument for making the asterisk abut the variable name
rather than the type is because the pointer-ness is indeed part of the
particular variable rather than of the type, and it can be summed up in one
simple question:
char* a, b, c;
Why should we want a, b and c to look the same, when a is different from
the other two?
True, but then this would be confusing:
typedef char* charp;
charp a, b, c;
IIUC, this declares all a, b, and c as char*; yet, the only difference
is the typedef is used to abbreviate the type. Maybe only a single
variable should be declared per statement, e.g.:
char* a;
char b;
char c;
This is more typing but less confusion.