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

silverlight - Applying a style to ItemContainerStyle in C# -

c# - NullReferenceException in MySqlClient.NativeDriver -

php - Updating recent updates - Problem in procedure - Any other approach? -