* warning: ‘struct ’ declared inside parameter list
@ 2009-02-15 1:16 Fundu
2009-02-15 2:20 ` Eric Polino
2009-02-16 17:03 ` ben
0 siblings, 2 replies; 4+ messages in thread
From: Fundu @ 2009-02-15 1:16 UTC (permalink / raw
To: linux-c-programming
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;
void send_req(struct query_resp* resp);
what i don't understand is why this warning when i have declared the struct before the function in the header.
what am i missing ?
thanks in advance !
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: warning: ‘struct ’ declared inside parameter list
2009-02-15 1:16 warning: ‘struct ’ declared inside parameter list Fundu
@ 2009-02-15 2:20 ` Eric Polino
2009-02-16 17:03 ` ben
1 sibling, 0 replies; 4+ messages in thread
From: Eric Polino @ 2009-02-15 2:20 UTC (permalink / raw
To: fundu_1999; +Cc: linux-c-programming
"None are more hopelessly enslaved than those who falsely believe they
are free."
--Goethe
"Freedom is living without government coercion."
--Ron Paul (www.ronpaul2008.com)
On Sat, Feb 14, 2009 at 20:16, Fundu <fundu_1999@yahoo.com> wrote:
> 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;
};
>
> void send_req(struct query_resp* resp);
void send_req(struct query_resp_type* resp);
>
>
> what i don't understand is why this warning when i have declared the struct before the function in the header.
>
> what am i missing ?
>
> thanks in advance !
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: warning: ‘struct ’ declared inside parameter list
2009-02-15 1:16 warning: ‘struct ’ declared inside parameter list Fundu
2009-02-15 2:20 ` Eric Polino
@ 2009-02-16 17:03 ` ben
2009-02-17 2:30 ` Fundu
1 sibling, 1 reply; 4+ messages in thread
From: ben @ 2009-02-16 17:03 UTC (permalink / raw
To: linux-c-programming
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: warning: ‘struct ’ declared inside parameter list
2009-02-16 17:03 ` ben
@ 2009-02-17 2:30 ` Fundu
0 siblings, 0 replies; 4+ messages in thread
From: Fundu @ 2009-02-17 2:30 UTC (permalink / raw
To: linux-c-programming, ben
thanks Ben !
--- On Mon, 2/16/09, ben <brouits@free.fr> wrote:
> From: ben <brouits@free.fr>
> Subject: Re: warning: ‘struct ’ declared inside parameter list
> To: linux-c-programming@vger.kernel.org
> 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@vger.kernel.org
> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-17 2:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-15 1:16 warning: ‘struct ’ declared inside parameter list Fundu
2009-02-15 2:20 ` Eric Polino
2009-02-16 17:03 ` ben
2009-02-17 2:30 ` Fundu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).