Tag: throw

Will the destructor be called?

August 10, 2010 00:00

Here's a C++ quiz for all of you: somefunc() will be called from a thread. Do you think this destructor will be called?

class A {
public:
    A () {
        printf("Constructor\t");
    }

    ~A() {
        printf("Destructor\n");
    }
};

int somefunc () {
    A inst;
    int* a = 0
    *a = 1;
    return 0;
}

...

Read post