From owner-freebsd-hackers Tue Feb 28 17:27:48 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id RAA27297 for hackers-outgoing; Tue, 28 Feb 1995 17:27:48 -0800 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id RAA26643 for ; Tue, 28 Feb 1995 17:15:09 -0800 Received: from sax.sax.de by irz301.inf.tu-dresden.de with SMTP (5.67b+/DEC-Ultrix/4.3) id AA13918; Wed, 1 Mar 1995 00:06:57 +0100 Received: by sax.sax.de (8.6.9/8.6.9-s1) with UUCP id AAA02870 for freebsd-hackers@freebsd.org; Wed, 1 Mar 1995 00:06:55 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.6.9/8.6.9) id XAA04754 for freebsd-hackers@freebsd.org; Tue, 28 Feb 1995 23:41:38 +0100 From: J Wunsch Message-Id: <199502282241.XAA04754@uriah.heep.sax.de> Subject: Re: porting software To: freebsd-hackers@FreeBSD.org (FreeBSD hackers) Date: Tue, 28 Feb 1995 23:41:37 +0100 (MET) In-Reply-To: <199502281805.LAA25222@seagull.rtd.com> from "Don Yuniskis" at Feb 28, 95 11:05:37 am Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 1835 Sender: hackers-owner@FreeBSD.org Precedence: bulk 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. ;-)