What\'s the difference between those three, and how shall I end program in case of exception which I can\'t handle properly?
My advice would be not to use any of them. Instead, catch
the exceptions you can't handle in main()
and simply return
from there. This means that you are guaranteed that stack unwinding happens correctly and all destructors are called. In other words:
int main() {
try {
// your stuff
}
catch( ... ) {
return 1; // or whatever
}
}