This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch to warn about non-static declaration follows static one
- To: mark at markmitchell dot com
- Subject: Re: Patch to warn about non-static declaration follows static one
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Thu, 22 Oct 1998 22:02:27 -0400 (EDT)
- Cc: egcs-patches at cygnus dot com
> From: Mark Mitchell <mark@markmitchell.com>
>
> >>>>> "Kaveh" == Kaveh R Ghazi <ghazi@caip.rutgers.edu> writes:
>
> Kaveh> Although it is perhaps legal, a non-static decl
> Kaveh> following a static one isn't portable. So I thought I'd
> Kaveh> make gcc warn about it like it already does for the
> Kaveh> opposite type of mismatch.
>
> This should only be done at some extreme level of warning paranoia.
> It's perfectly legal to omit the `static' despite the protestations of
> some antiquated K&R compilers, and this warning will result in a *lot*
> of noise on perfectly OK code.
> --
> Mark Mitchell mark@markmitchell.com
Beyond the K&R compiler problem, I also happen to think this is
bad practice because you can't look at a function definition and know if
it is static or not because somewhere else (perhaps in another header
file) it might be declared static.
Gcc already warns about other coding styles, for example, "if (a
= b)" and makes you use "if ((a = b))" or ambiguous else clauses making
you add braces, even though both are "perfectly OK code" as you say. :-)
So I don't see a problem with warning about another.
--Kaveh
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Icon CMT Corp.