Topic: Compiler warning for not used variables and old style function definitions
Author: spatel@cs.tamu.edu (Samir K Patel)
Date: 27 Feb 1993 14:22:33 GMT Raw View
I am relatively new to c++. I am getting warnings while compiling the c++ code
which I want to remove with some compile time options.
Warnings are for declaring the variables and not using it anywhere in the
program and old style definition of various functions.
My program is working fine but I just want to get rid of these warnings.
Can anyone suggest some compile time options to get rid of these warnings.
I am using SUN's CC compiler (version 2.1).
Thanks
Samir
(spatel@photon.cs.tamu.edu)
Author: pickerig@eee.bham.ac.uk (Guy Pickering)
Date: 1 Mar 1993 17:39:43 GMT Raw View
Samir K Patel (spatel@cs.tamu.edu) wrote:
: Warnings are for declaring the variables and not using it anywhere in the
: program and old style definition of various functions.
:
It is sometimes neccesary to have parameters that are not used. Eg.
Xt callback functions. To get rid of the warning just include
the type, but not the variable name:
void
CBmyCallback( Widget widget, caddr_t client_data, caddr_t)
{
// The last parameter is not used, so it is not included.
}
For variables declared inside the main body of the function,
get rid of them.
Guy.
--
+--------------------------------+-----------------------------------------+
| Guy Pickering | School of Electronic & Electrical Eng, |
| E-MAIL: G.PICKERING@uk.ac.bham | University of Birmingham, |
| Tel: +44 (021) 414 4340 | Edgbaston, Birmingham. B15 2TT. |
| Fax: +44 (021) 414 4291 | ENGLAND. |
+--------------------------------+-----------------------------------------+