Return statement within a catch
Why do I get this error message:
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Runtime Error!
Program: C:\*****.exe
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
---------------------------
OK
---------------------------
When I try to do this:
EDIT: Found out what is the problem. You actually need to throw "something" as throw statement is like a function and it need to take 1 argument. So just replace throw; with throw 0; or throw 1; Doesn't matter.
---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Runtime Error!
Program: C:\*****.exe
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
---------------------------
OK
---------------------------
When I try to do this:
Code:
void main()
{
try
{
throw;
}
catch (...)
{
MessageBox(NULL, "Failed to initialize the programme.", "Error", MB_OK | MB_ICONERROR);
return;
}
}
