the simple code below
// g++ centro.cc -o centro
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
try
{
cout << "Going to throw" << endl;
throw;
}
catch(...)
{
cout << "An exception occurred" << endl;
}
return 0;
}
produces an abort:
Going to throw
terminate called without an active exception
Aborted (core dumped)
I don’t understand what’s wrong, can anybody point me in the right direction?
Your line
is the syntax for re-throwing an exception in a
catchblock.You should write: