fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int foo() throw();
  5.  
  6. int foo() throw() {
  7. throw 3;
  8. }
  9.  
  10. int bar() {
  11. // do something here
  12. foo();
  13. }
  14.  
  15. int main() {
  16. try {
  17. bar();
  18. } catch(...) {
  19. std::cout << "Caught";
  20. }
  21. }
Runtime error #stdin #stdout #stderr 0s 3452KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
terminate called after throwing an instance of 'int'