File: cpp_routine.cpp

package info (click to toggle)
gprbuild 2014dfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,564 kB
  • ctags: 195
  • sloc: ada: 110,384; xml: 3,632; sh: 2,810; makefile: 363; ansic: 204; cpp: 89; fortran: 62; asm: 27
file content (36 lines) | stat: -rw-r--r-- 541 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#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;
    }
}