You’re not gonna catch this…

You're not gonna catch this... (LIttle League baseball, May 2009 - 03 by Ed Yourdon; CC BY-SA 2.0)

C++ exceptions can be surprising. This works easily:

try
{
throw(1);
}
catch(…) //Catch all
{
//caught
}

But if you replace “throw(1);” with “throw;”, it suddenly doesn’t work anymore. Code compiles, exception is thrown, but it’s not caught. The program is terminated

Leave a Reply

You must be logged in to post a comment.