Date: Tue, 28 Feb 1995 23:41:37 +0100 (MET) From: J Wunsch <j@uriah.heep.sax.de> To: freebsd-hackers@FreeBSD.org (FreeBSD hackers) Subject: Re: porting software Message-ID: <199502282241.XAA04754@uriah.heep.sax.de> In-Reply-To: <199502281805.LAA25222@seagull.rtd.com> from "Don Yuniskis" at Feb 28, 95 11:05:37 am
next in thread | previous in thread | raw e-mail | index | archive | help
As Don Yuniskis wrote:
>
> Frequently, when porting software to FreeBSD, the compiler emits
> "... was declared implicitly `extern' and later `static'" errors.
> I understand their cause and realize adding a prototype is the
> correct and easiest way to silence them (barring a compiler switch).
> However, can I simply ignore them?
Yes. They're ususally a leftover from old-day engineers who still
think that every function returns ``something like'' an int. Why
declare functions?...
> Currently, I simply examine the
> offending function declaration and, if it returns 'int', assume the
> "implicit" declaration will coincide with the "explicit" declaration.
> (figuring that the real potential for screw up lies in a function
> which returns something *other* than int. Q: will the compiler
> emit a *real* error in those cases?) Should I also be examining
Yes, the compiler will generate an error if the function is later
being defined to return something else than an int. (Type mismatch
with previous implicit declaration.)
> arguments, etc.? Likewise for 'non-static' --> 'static' warnings...
> Any other "general comments"?
If you have the time, convert everything to ANSI style. Either use
prototypes, or rearrange the code Pascal-like, with main() being the
last function. (99 % of all functions do not need to be forward-
declared, they can be defined in place as well.)
If you feel cautious about people using ancient compilers, bracket
the prototypes within #if __STDC__. (Generally, _i_ don't.) Watch
out for implicit casts if you do this:
int foo(c, f)
char c;
float f;
{}
is equivalent to
int foo(int c, double f) {}
mv FLAMES /dev/null ;-)
--
cheers, J"org
joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/
Never trust an operating system you don't have sources for. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199502282241.XAA04754>
