unused variable

Hi,

Please go through the code

//Test.h

class test
{
public:
test();
~test();
void display();

private:
int* m_displayVar;

};

//Test.cpp

#include "Test.h"

void test::display
{
int a =10;
m_displayVar = &a;
std::cout<<"Value ="<<*m_displayVar<<std::endl;
}

//main.cpp

#include "test.h"

int main()
{
test t;
t.display();
return 0;
}

When I am putting the follwing code to logiscope rule checker with MISRA C++ standard I get the following violation:

1. In test.h m_displayVar is said to be unused variable.
2. test is said not to have a unique name.
3.Desctructor is not called.

Please help me out of this

Regards,
Sanjib
what happens when you compile it? it runs properly doesn’t it?
Topic archived. No new replies allowed.