On 16/07/2010 00:59, J Decker wrote: > ------------------------------ > > #define PointerA struct a * > > void f( PointerA ); > > typedef struct a * PA; > struct a { int x; }; > > void f( PA a ) > { > } > > --------------------------------- > > This is the output > > warning: 'struct a' declared inside parameter list > warning: its scope is only this definition or declaration, which is > probably not what you want > error: conflicting types for 'f' > note: previous declaration of 'f' was here > > > -------------------------------- > > This is valid C code by every other compiler.
Not so, as far as I can tell. Comeau online says: > Comeau C/C++ 4.3.10.1 (Oct 6 2008 11:28:09) for ONLINE_EVALUATION_BETA2 > Copyright 1988-2008 Comeau Computing. All rights reserved. > MODE:strict errors C99 > > "ComeauTest.c", line 3: warning: declaration is not visible outside of > function > void f( PointerA ); > ^ > > "ComeauTest.c", line 8: error: declaration is incompatible with "void > f(struct a *)" > (declared at line 3) > void f( PA a ) > ^ > > 1 error detected in the compilation of "ComeauTest.c". As long as "struct a" hasn't been (forward-)declared at the time the declaration of f() is found, it is a different one from the "struct a" in the global namespace that the formal parameter on the definition of f() then subsequently refers to. cheers, DaveK