I would like a standard reference why the following code triggers a compliance warning in C (tested with gcc -pedantic
; "typedef redefinition"), but is fine in C++ (g++ -pedantic
):
typedef struct Foo Foo;
typedef struct Foo Foo;
int main() { return 0; }
Why can I not define a typedef
repeatedly in C?
(This has practical implications for the header structuring of a C project.)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…