Will exit() or an exception prevent an end-of-scope destructor from being called?

Posted by Truncheon on Stack Overflow See other posts from Stack Overflow or by Truncheon
Published on 2010-04-19T14:17:09Z Indexed on 2010/04/19 14:23 UTC
Read the original article Hit count: 161

Filed under:
|
|

Let's say I have the following code:

struct mytype
{
    ~mytype() { /* do something like call Mix_CloseAudio etc */ }
};

int main()
{
    mytype instant;

    init_stuff();

    start();

    return 0;
}

Is that destructor guaranteed to be called even if exit() is used from somewhere inside start() ?

© Stack Overflow or respective owner

Related posts about c++

Related posts about destructor