解决方法
您可以在7.1.3节中阅读与C 2003 ANSI ISO IEC 14882 2003的typedef说明符相关的所有规则.在7.1.3中,2)已经说过,如果名称已经引用了某种类型,则允许使用identity typedef.
这是合法的:
typedef int Request; typedef Request Request; // Redefines "Request" with no effect
而事实并非如此:
typedef Request Request; // Illegal,first "Request" doesn't name a type.
该标准有一个与此相关的具体例子. C 2003,§7.1.3/ 2:
In a given non-class scope,a typedef specifier can be used to redefine the name of any type declared in
that scope to refer to the type to which it already refers. [Example:
typedef struct s { /* ... */ } s; typedef int I; typedef int I; typedef I I;
—end example]
在7.1.3中,3)已经说过禁止使用typedef将类型重新定义为别名到别名