Vladimir Grigoriev
2009-09-21 15:04:01 UTC
Should be destructor called always irrespective of that a pointer is equal
to 0?
What does the C++ standard say about this?
Example
T *p = 0;
delete p; // will be a destructor of T object called here?
It seems that operation 'delete p' when p == 0 is not safe. I asked this
question because inside of some code of std::auto_ptr I see the following
~auto_ptr()
{
delete p;
}
Vladimir Grigoriev
Vladimir Grigoriev
to 0?
What does the C++ standard say about this?
Example
T *p = 0;
delete p; // will be a destructor of T object called here?
It seems that operation 'delete p' when p == 0 is not safe. I asked this
question because inside of some code of std::auto_ptr I see the following
~auto_ptr()
{
delete p;
}
Vladimir Grigoriev
Vladimir Grigoriev