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

drupal - using views argument in the view tpl.php file -

php - Posting PHPBB Forum Thread/Post info in a website -

php - Add a blog by sending a mail to a certain emailadress -