Files
gprbuild/examples/ada_cpp/src1/cpp_routine.cpp
Cyrille Comar bd096bfe99 add ada/c++ examples
git-svn-id: svn+ssh://svn.eu.adacore.com/Dev/trunk/gprmake@43597 936e1b1b-40f2-da11-902a-00137254ae57
2007-04-10 13:28:19 +00:00

37 lines
541 B
C++

#include <iostream>
#include "cpp_routine.h"
using namespace std;
void recurse_then_raise (int n);
void cpp_routine ()
{
cout << " In cpp_routine" << endl;
cout << " Calling recurse_then_raise" << endl;
try
{
recurse_then_raise (10);
}
catch (int except)
{
cout << " caught an exception: " << except << endl;
}
cout << " returning from cpp_routine." << endl;
}
void recurse_then_raise (int n)
{
if (n > 0)
{
recurse_then_raise (n - 1);
}
else
{
throw 1;
}
}