Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript |
c++ - try-catch
What should normally happens in the following C++ code? void ups() { int a=0,b;b/=a; } // couse divide by 0 exception class A { public: ~A() { ups(); } }; void do_some() { try { A a; ups(); } catch (...) { } } void main() { try { do_some(); } catch(...) { } } Oct 25 2002
Should call unexpected() (or it may be terminate() - is late here ... ) as you cannot throw within an unwind. This is one of the reasons that destructors should not throw exceptions. I'm pretty sure it's terminate(), since unexpected() is to do with mismatch wrt ex-specs. Matthew "K Sergey" <K_member pathlink.com> wrote in message news:apbgm1$2rrf$1 digitaldaemon.com...What should normally happens in the following C++ code? void ups() { int a=0,b;b/=a; } // couse divide by 0 exception class A { public: ~A() { ups(); } }; void do_some() { try { A a; ups(); } catch (...) { } } void main() { try { do_some(); } catch(...) { } } Oct 31 2002
|