Can I catch bad pointer errors in C++?
- by Simon
Hi there,
I was wondering if there is a possibility to catch errors like this in C++:
object* p = new object;
delete p;
delete p; //this would cause an error, can I catch this?
Can I check if the pointer is valid?
Can I catch some exception?
I know I could set the pointer p to NULL after the first object deletion. But just imagine you wouldn't do that.
I am using VC++ with Visual Studio 2008/2010.
Thank you