5
我一直在使用GCC 4.6開發我的應用程序進行編譯,但用戶報告了「typedef的重新定義」錯誤。一些混亂,我錯誤地告訴用戶獲取使用Git最新的源代碼後,我接過定睛一看,發現了一些與此類似:爲什麼使用GCC 4.3重新定義typedef錯誤而不是GCC 4.6?
/* 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,但爲什麼這不再是一個錯誤?還是需要報告?
cant ...等...直到...我們替換... C預處理器...與一個實際的...腳本語言...像PHP或客觀C smalltalk模擬.. – Dmitry