c++ - function try block. An interesting example -
consider following c++ program
struct str { int mem; str() try :mem(0) { throw 0; } catch(...) { } }; int main() { str inst; }
the catch block works, i.e. control reaches it, , program crashes. can't understand what's wrong it.
once control reaches end of catch block of function-try-block of constructor, exception automatically rethrown. don't catch further in main(), terminate() called. here interesting reading: http://www.drdobbs.com/184401316
Comments
Post a Comment