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

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -