Now, Int has the same meaning as int. So the compiler gives the second element behind typedef ( Int ) the meaning of the first element ( int ). But why then doesn't this work:
typedefchar[ 260 ] string;
and does this work:
typedefchar string[ 260 ];
It seems to me that it is more logical vice versa, because string now means a char array of 260 elements.
The syntax of a typedef is the same as the syntax of an object declaration, except that the keyword 'typedef' is added in the beginning:
1 2 3 4
int Int; // object called Int, of type int
typedefint Int; // type called Int, alias of int
char string[ 260 ]; // object called "string", of type char[260]
typedefchar string[ 260 ]; // type called "string", alias of char[260]
if you want to use a more intuitive syntax, C++ has one (since last year)
Yes, of course, it's under ยง7.1.3[dcl.typedef]/2 in C++11, the paragraph that starts with "A typedef-name can also be introduced by an alias-declaration"