[openbeos] Re: -Wmissing-prototypes

  • From: "Andrew Bachmann" <shatty@xxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 30 Dec 2003 20:48:41 -0800 PST

"Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx> wrote:
> "Andrew Bachmann" <shatty@xxxxxxxxxxxxx> wrote:
> > And adding this line in front:
> > 
> > extern int function(void);
> > 
> > But this seems really stupid.  Does anyone have a strong 
> > argument for preserving this warning?  
> 
> It's known as "good style" when put all of your function prototypes at 
> the top of the file which is going to use it (or a header file).
> I wouldn't like to remove the warning.
> 
> Bye,
>    Axel.

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) {
}

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.

Andrew


Other related posts: