[openbeos] Re: -Wmissing-prototypes

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Wed, 31 Dec 2003 14:15:37 +0100 CET

"Andrew Bachmann" <shatty@xxxxxxxxxxxxx> wrote:
> In my opinion this imposes an extra burden on the coder
> and encourages the coder to implement functionality in
> fewer functions -- the exact opposite of good style.  While
> it's obvious that you should put function prototypes in the
> header to expose the interface to a compilation unit, it
> doesn't make sense to have to have the prototypes within
> a compilation unit.  I mean, we are going to literally
> write this in quite a few cases:
> 
> extern int function(void);
> int function(void) {
> }

Note, that this would be this according to our style guide:
int
function(void)
{
}

:-))

> Heck, I may as well just define a macro that doubles the
> text and deposits a semi in between with an extern at
> the beginning.
> 
> BTW, I should point out that these warnings are
> apparently not being generated for c++ files, regardless
> of the flag being provided to gcc for them.

C only puts out that warning if you define a global symbol that will be 
exported to other files. If you are only needing these symbols locally, 
you should state so by adding a "static" before the definition, and the 
warning will disappear:

static int
function(void)
{
}

HTH

Bye,
   Axel.


Other related posts: