6

我一直在使用 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 版本,这很容易修复,但为什么这不再是错误?还是需要报告?

4

1 回答 1

6

这看起来像是一个刻意的改变......

我手头没有 4.6,但如果你使用-pedantic.

于 2011-06-29T20:14:14.340 回答