C++ 疯狂 typedef : what is the point of allowing this syntax by the Standard?

标签 c++ typedef standards-compliance iso user-defined-types

老熟人:

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/

相关文章:

c++ - 如何获取派生自基类的类型名?

c - 初始化包含指向其自身类型的指针的常量结构

c - 为什么一致性实现的行为会有所不同 w.r.t.具有内部链接的不完整数组类型?

c++ - 如何关联具有不同名称的依赖 vcproj 文件中的构建配置?

C++ 部分互斥锁/临界区锁

c++ - Obj-C NSLog 缓冲区

android - 在 StringDef/TypeDef android 中使用资源字符串值

json - 标准定义json文件扩展名?

cross-browser - CSS 中的渐变

javascript - 如何在 Duktape 中创建 C++ 对象