Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!ames!elan!tom From: tom@elan.Elan.COM (Thomas Smith) Newsgroups: comp.lang.c++ Subject: Re: Can I turn off specific "not used" warnings in cfront? Message-ID: <878@elan.Elan.COM> Date: 14 Nov 90 19:03:50 GMT References: <1084@ntpal.UUCP> Organization: Elan Computer Group, Inc., Mountain View, CA Lines: 40 From article <1084@ntpal.UUCP>, by herrage@ntpal.UUCP (Robert Herrage): > > > I'm sending this a different way since the first way hasn't been > working very well. So, if you're getting this again, I apologize. > > Yes! You can eliminate the "not used" warnings! Below is a simple > example: > > void funcname( > int x; > int y; > int z ) > { > x,y; // this will eliminate the "not used" warnings > > printf( "%d", z ); > > } However, this could (on some compilers) generate code for the comma-separated expression "x,y;". There are two other alternatives: 1) If the variable that you don't want to use is a function parameter, as in the example above, simply leave off the parameter name from the definition. i.e. void funcname(int, int, int z) { printf("%d", z); } 2) If the variable is an automatic variable or a global (such as SCCS ids) I found that if you define an inline function that takes a parameter, but has no body, no code will be generated. i.e. inline void NotUsed(const void *anything) {} NotUsed(SCCSid); // suppresses "not used" warning Hope this helps, Thomas Smith Elan Computer Group, Inc. (415) 964-2200 tom@elan.com, ...!{ames, uunet, hplabs}!elan!tom