Re: warning: ‘struct ’ declared inside parameter list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



thanks Ben !


--- On Mon, 2/16/09, ben <brouits@xxxxxxx> wrote:

> From: ben <brouits@xxxxxxx>
> Subject: Re: warning: ‘struct ’ declared inside parameter list
> To: linux-c-programming@xxxxxxxxxxxxxxx
> Date: Monday, February 16, 2009, 9:03 AM
> Fundu a écrit :
> > i'm running ubuntu 8.04 with gcc-4.2 
> > and i'm getting 
> > 
> > mb_con.h:43: warning: ‘struct query_resp’ declared
> inside parameter list
> > mb_con.h:43: warning: its scope is only this
> definition or declaration, which is probably not what you
> want
> > here's a snippet of how .h file looks
> > 
> > struct query_resp_type
> > {
> >   int type;
> > } query_resp;
> you defined here _both a type and a variable_.
> this should not be done inside a .h file...
> 
> maybe you expected to redefine a type, and forgot to
> 'typedef' ?
> ==
> struct query_resp_type {
>   int type;
> };
> 
> typedef struct query_resp_type query_resp;
> ==
> after such a typedef, you will be able to use type
> 'query_resp'
> (note that 'struct' is not part of the type name)
> 
> > void send_req(struct query_resp* resp);
> wrong. type 'struct query_resp' does not exist.
> but 'struct query_resp_type' does.
> > 
> > 
> > what i don't understand is why this warning when i
> have declared the struct before the function in the header.
> typo issue.
> 
> > what am i missing ?
> see above
> > thanks in advance !
> > 
> --
> To unsubscribe from this list: send the line
> "unsubscribe linux-c-programming" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at 
> http://vger.kernel.org/majordomo-info.html


      
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Assembler]     [Git]     [Kernel List]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [C Programming]     [Yosemite Campsites]     [Yosemite News]     [GCC Help]

  Powered by Linux