Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 22.1: object declaration and deleted timing
#1
Hi, I have a question about object declaration and deleted timing.
I need to declare an object in constructor and release it in deconstructor, because the object will be reused frequently, but it is not compliant on MISRA C 2012.
The sample code as below.
Could you give me any hint to solve it?
Thanks.

Code:
ABC::aa(const Arguments& args)
{
    pImpl = new ABC::impl(args);
}

ABC::~aa()
{
    delete pImpl;
    pImpl = NULL;
}


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)