I would like to know when the destructor for thrown object is called. I expected that it is called only one time (and not two or three times) after the catch block is executed. So in order to check that, I wrote a simple program and it gave me three different outputs when compiled with Sun CC, DEC cxx and GNU g++ (last gave me internal compiler error, but when I commented last line of main() it compiled OK). Now, Am I doing something totaly wrong, or that three compilers generate incorect code (and which one generated correct code, if any)? Here is program, and the outputs it gives when compiled with before mentioned compilers: #include class exp { public: exp(int x); ~exp(); int i; }; exp::exp(int x) { cout << "Constructor exp(" << x << ")\n"; i = x; } exp::~exp() { cout << "Destructor ~exp()\n"; } main() { try { cout << "Throwing exception\n"; throw exp(1); } catch (exp a) { cout << "Catched exp(" << a.i << ")\n"; } cout << "Exiting\n"; } When compiled with Sun CC: Throwing exception Constructor exp(1) Catched exp(1) Destructor ~exp() Destructor ~exp() Exiting When compiled with DEC cxx: Throwing exception Constructor exp(1) Destructor ~exp() Catched exp(1) Destructor ~exp() Destructor ~exp() Exiting When compiled with GNU g++ (last line of main() commented): Throwing exception Constructor exp(1) Destructor ~exp() Catched exp(1) -- Aleksandar Milivojevi� http://jagor.srce.hr/~alex/ e-mail: alex@srce.hr ================================ooooO=Ooooo============================== Real Users never know what they want, but they always know when your program doesn't deliver it.