I just stumbled this code:
void somefunction()
{
throw;
}
and I wonder: what does it mean?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The intent is probably that
somefunction()is only ever called from inside somecatchblock. In that case, there would be an exception active when thethrow;is executed, in which case the current exception is re-thrown, to be caught by the next outer handler that can handle that exception type.If
throw;is executed when an exception is not active, it callsterminate()(N4810, §[expr.throw]/4).