我一直在使用 GCC 4.6 开发我的应用程序进行编译,但用户报告了“重新定义 typedef”错误。在我错误地告诉用户使用 Git 获取最新源的一些混乱之后,我仔细查看并发现类似于以下内容:
/* mystruct.h */
#ifdef MYSTRUCT_H
#define MYSTRUCT_H
typedef struct _mystruct mystruct
#endif
/* mystruct.c */
#include "mystruct.h"
typedef struct _mystruct
{
int a;
int b;
} mystruct;
对于较旧的 GCC 版本,这很容易修复,但为什么这不再是错误?还是需要报告?