I have small piece of code:
using namespace std;
int *p = new int(10);
if(p != NULL)
cout<<"Deleted dynamic allocated memory"<<endl;
if(p == NULL)
It would often be unnecessary, particularly in well-written code.
It could hide away bugs.
delete p; would be syntactically idiosyncratic if it modified its argument.
On (1) it would be particularly wasteful with
In other words, burdening the programmer with this job if necessary is the right thing to do.