Remove warning "unused parameters"
-
I have a C++ class that implements a interface (ErrorInterface), because of old design. My class don't uses one of the methods (reset) in this interface but I have added an empty implementation because I don't want the class to be abstract. When I build the project I get warnings "unused parameters 'error'". Can I remove this warning?
//Interface
class ErrorInterface
{
public:
virtual void reset(ErrorType error) = 0;
};//.cpp file I have just added the implementation
//because I don't want MyClass to be abstract
void MyClass::reset(ErrorType error)
{
} -
I have a C++ class that implements a interface (ErrorInterface), because of old design. My class don't uses one of the methods (reset) in this interface but I have added an empty implementation because I don't want the class to be abstract. When I build the project I get warnings "unused parameters 'error'". Can I remove this warning?
//Interface
class ErrorInterface
{
public:
virtual void reset(ErrorType error) = 0;
};//.cpp file I have just added the implementation
//because I don't want MyClass to be abstract
void MyClass::reset(ErrorType error)
{
}Either of the following methods will remove the warning -
void MyClass::reset(ErrorType)
{
}OR
void MyClass::reset(ErrorType error)
{
error;
}Or you can use the
UNREFERENCED_PARAMETER
macro which does the same as the second method -void MyClass::reset(ErrorType error)
{
UNREFERENCED_PARAMETER(error);
}«_Superman_» _I love work. It gives me something to do between weekends.
-
Either of the following methods will remove the warning -
void MyClass::reset(ErrorType)
{
}OR
void MyClass::reset(ErrorType error)
{
error;
}Or you can use the
UNREFERENCED_PARAMETER
macro which does the same as the second method -void MyClass::reset(ErrorType error)
{
UNREFERENCED_PARAMETER(error);
}«_Superman_» _I love work. It gives me something to do between weekends.