A throw-expression with no operand re-throws the exception currently being handled. such an expression shoshould appear only in a catch handler or in a function called from within a catch handler. the re-thrown exception object is the original exception object (not a copy ). for example:
try { throw CSomeOtherException();}catch(...) { // Handle all exceptions // Respond (perhaps only partially) to exception // ... throw; // Pass exception to some other handler}
An empty throw statement tells the compiler that the function does not throw any exceptions. It is the equivalent to using _ declspec (nothrow). For example:
// exceptions_trycatchandthrowstatements3.cpp void empty() throw(){ puts("In empty()");}void with_type() throw(int){ puts("Will throw an int"); throw(1);}int main(){ try { empty(); with_type(); }catch (int){ puts("Caught an int"); }}