What is the best way to check the pointer return by a new operator
I see following type of code. Assume I have class Test
Type 1
Test *ptr = new Test;
if ( ptr == NULL ) {
}
Type 2
Test *ptr = new Test;
if ( !ptr ) {
}
Type 3
Test *ptr = new Test;
if ( ptr == (Test*)0 ) {
}