Date: Wed, 4 Nov 1998 09:56:43 -0800 (PST) From: Archie Cobbs <archie@whistle.com> To: asmodai@wxs.nl (Jeroen Ruigrok/Asmodai) Cc: current@FreeBSD.ORG Subject: Re: Current 'make world' warnings cleanup Message-ID: <199811041756.JAA12092@bubba.whistle.com> In-Reply-To: <XFMail.981104091025.asmodai@wxs.nl> from Jeroen Ruigrok/Asmodai at "Nov 4, 98 09:10:25 am"
next in thread | previous in thread | raw e-mail | index | archive | help
Jeroen Ruigrok/Asmodai writes: > >> Sounds good. Just one thing: don't fall prey to the temptation to > >> fix all the pointer mismatch warnings by blindly inserting casts just > >> to make the compiler shut up. That's a common mistake, and as often > >> as not it simply hides the real problem from the compiler rather than > >> fixing it. > > > > Another gotcha when doing this.. often "unused variable" warnings > > happen because there is a variable declared that is only used > > when certain #ifdef's are true. The solution in these cases is > > not to remove the variable, but to enclose it's declaration > > within equivalent #ifdef's.. > > So in general someone forgot to put them between the appropriate definition > statements right? Either by mistake or whatever... Not sure what you mean by that.. I think so.. The point is.. depending on what #ifdef's you have, a variable may go from used to unused or vice versa. This can be avoided by having the declaration of the variable happen if-and-only-if the variable is used. Same goes for static functions in a file. -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811041756.JAA12092>