老熟人:
typedef int cute_int; //cute : common and familiar syntax.
这个语法很完美。没问题。
现在,当我们可以像上面那样编写 typedef 时,那么允许这种语法的意义何在:
int typedef crazy_int; //crazy : uncommon and unfamiliar syntax.
只是为了迷惑程序员?这种语法是否在任何地方都需要(实际上我们已经使用了前一种)?从编译器的角度你怎么看?他们觉得它可爱还是疯狂?还是对编译器根本不重要?
顺便说一句,这段代码来自这里: Use of typename keyword with typedef and new
如果您想知道这是否是语法错误,请查看 the working code here在ideone。
最佳答案
关于C++ 疯狂 typedef : what is the point of allowing this syntax by the Standard?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4422816/