Given the following code:
int main()
{
try
{
throw int{};
}
catch(...)
{}
return 0;
}
The catch(...) block catches everything, so there is no way for the thrown int to be left unhandled. Yet if we inspect the assembly code generated by the compiler, regardless of what compiler we use, what platform we target or what optimization flags we use, there's always an opaque call to a throw function called, exception handlers are installed and the stack is unwound.
Why is the program not simply return 0;? Is there a reason for it in the standard?