Use throw; carefully. Or else, Unhandled exception will be the result.

20 04 2008


Usually throw; is used to rethrow the exception object. But you should be careful. If you call throw; where there is no exception object in the context, then it will result an un-handled exception and abnormal program termination. The interesting part is that, even catch(…) cannot catch such exceptions.


See the sample code snippet below.

try
{
    throw;
}
catch( ... )
{
}

So take care next time.


Targeted Audience – Intermedite.

Advertisements