M
ma740988
Given the snippet.
class foo {
public:
~foo() {
// type id should be able to get the type of the class ( I think )
std::cout << " foo destructing " << std::endl;
}
};
int main() {
foo *ptr = new foo () ;
delete ptr;
foo *ptr_ ( 0 );
if ( ptr_ ) {
delete ptr_ ;
}
}
If memory serves the check "if ( ptr_ )" is NEVER (UN) necessary.
Trouble is, I don't recall the impetus surrounding why or where in the
standard I found this. My standard is not within arms reach that
said, the question: Could I get confirmation on that deleting a void
pointer is indeed valid and where (source) in the standard I could
confirm this?
Thanks alot
class foo {
public:
~foo() {
// type id should be able to get the type of the class ( I think )
std::cout << " foo destructing " << std::endl;
}
};
int main() {
foo *ptr = new foo () ;
delete ptr;
foo *ptr_ ( 0 );
if ( ptr_ ) {
delete ptr_ ;
}
}
If memory serves the check "if ( ptr_ )" is NEVER (UN) necessary.
Trouble is, I don't recall the impetus surrounding why or where in the
standard I found this. My standard is not within arms reach that
said, the question: Could I get confirmation on that deleting a void
pointer is indeed valid and where (source) in the standard I could
confirm this?
Thanks alot