Is this a GCC bug ?

Dan Mick dan at charyb.COM
Thu Feb 1 15:50:43 AEST 1990


In article <7948 at shlump.nac.dec.com> nadkarni at ashok.dec.com writes:
|
|Is this a bug in the Gnu CC compiler or is it illegal C ?
|
|------------------------------
|typedef void foo(struct urb *p);
|
|
|struct urb 
|{
|    int i;
|} ;
|-------------------------------
|gcc -S bug.c
|bug.c:1: warning: `struct urb' declared inside parameter list
|bug.c:1: warning: such a name is accessible only within its parameter list,
|bug.c:1: warning: which is probably not what you want.
|
|Thanks,
|
|/Ashok Nadkarni
|Digital Equipment Corp.


It's possible I'm being incredibly dense again, but it seems to me that you
need to define struct urb before you get to the typedef in order to 
avoid the warning; all it's telling you is that it doesn't know about
struct urb until it sees the parameter list.  

True, the parm p is a struct urb * and not struct urb, so it doesn't need 
the size info, but until you define struct urb later, it's warning you that 
you can't use struct urb in any other context.  

The program still works, right?



More information about the Comp.lang.c mailing list