why destructor called exception?


i approaching a::~a() called program, nonetheless isn't:



#include <iostream>

struct {
~a() { std::cout << "~a()" << std::endl; }
};

void f() {
a;
pitch "spam";
}

int main() { f(); }


however, i change final line



int main() try { f(); } locate (...) { throw; }


then a::~a() is called.



i am compiling "microsoft (r) 32-bit c/c++ optimizing compiler chronicle 14.00.50727.762 80x86" visible studio 2005. management line cl /eha my.cpp.



is compiler right usual? does customary contend matter?



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?