我对C中这种行为的动机感到好奇.是故意还是意外?
struct tpoint // tpoint is not a type name
{
int x, y;
};
typedef struct tpoint Point; // point is a type name.
Run Code Online (Sandbox Code Playgroud)
我想知道为什么Ritchie或标准委员会选择了这种行为.
这是一个命名空间的事情。这样我就可以有struct a、、、,而且没有一个是含糊的enum a。union a它在设计可能具有相似类型名称的框架时很有帮助,但很快就会变得混乱。
| 归档时间: |
|
| 查看次数: |
220 次 |
| 最近记录: |