All of lore.kernel.org
 help / color / mirror / Atom feed
From: ben <brouits@free.fr>
To: linux-c-programming@vger.kernel.org
Subject: Re: warning: ‘struct ’ declared inside parameter list
Date: Mon, 16 Feb 2009 18:03:26 +0100	[thread overview]
Message-ID: <49999C5E.1000401@free.fr> (raw)
In-Reply-To: <875251.26275.qm@web63406.mail.re1.yahoo.com>

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

  parent reply	other threads:[~2009-02-16 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2009-02-17  2:30   ` Fundu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49999C5E.1000401@free.fr \
    --to=brouits@free.fr \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.