@ chrisname:
The thing is,
T
is a type, but
T*
is a
different type.
Case in point, you can't do this:
1 2 3 4
|
int a;
int* b;
b = a; // error, mismatching types
|
Therefore, logically, the * is a part of the type (indicating the type is a pointer, rather than an int).
Taking that logic, let's examine the following declaration:
"int" is the type, and "a,b,c" are the variables you want of that type.
So logically...
int* a,b,c;
you would think "int*" is the type, and "a,b,c" are variables of that type, because that would be the most consistent.
But of course that's not how it works. IE: it's inconsistent.
typedef complicates things even more:
1 2 3 4
|
typedef int* intp;
int* a, b; // not the same types
intp c, d; // ? are c and d the same type?
|
To be honest, I didn't know the answer to the above until I tried it.
As it turns out... typedef behaves logically (intp is the type, therefore both c and d would be pointers). But it just goes to show you how inconsistent and crazy the whole pointer declaration thing is.
I guess you got me there. But honestly I don't see why you'd ever want to do that.