how to handle delete by illegal address
- by Davit Siradeghyan
Suppose we have a situation like this. How to handle this problem? How to protect code from crashes? I know about and use boost smart pointers. But what to do if we have this situation.
struct Test
{
    int a;
    int b;
    int c;
};
Test global;
int main()
{
    Test *p = new Test;
    p->a = 1;
    p->b = 2;
    p->c = 3;
    p = &global;
    delete p;
    return 0;
}