ReactOS  0.4.15-dev-3303-g1ade494
recursive_throw.cpp File Reference
#include <stdio.h>
#include <windows.h>
Include dependency graph for recursive_throw.cpp:

Go to the source code of this file.

Macros

#define MAX_REC   200
 
#define NLOOPS   10
 

Functions

void foo (int level)
 
int main (void)
 

Macro Definition Documentation

◆ MAX_REC

#define MAX_REC   200

Definition at line 10 of file recursive_throw.cpp.

◆ NLOOPS

#define NLOOPS   10

Definition at line 13 of file recursive_throw.cpp.

Function Documentation

◆ foo()

void foo ( int  level)

Definition at line 25 of file recursive_throw.cpp.

26 {
27  if(level < MAX_REC)
28  {
29  try
30  {
31  foo(level+1);
32  }
33  catch(int& throw_level)
34  {
35  //printf("Level %d catched level %d\n",level,throw_level);
36  throw_level = level;
37  //printf("Level %d throwing\n",level);
38  throw level;
39  }
40  }
41  else
42  {
43  printf("Level MAX_REC throwing.\n");
44  throw level;
45  }
46 }
GLint level
Definition: gl.h:1546
#define MAX_REC
void foo(int level)
#define printf
Definition: config.h:203

Referenced by main().

◆ main()

int main ( void  )

Definition at line 48 of file recursive_throw.cpp.

49 {
50  int n;
51  LARGE_INTEGER freq,start,end;
52 
53 #if !defined(_M_AMD64) && !defined(_M_ARM) && !defined(_M_ARM64)
56 #endif
57 
58  //printf("Max Recursion level: %d\n", MAX_REC);
59  printf("N loops: %d\n", NLOOPS);
60 
61  for(n=0;n<NLOOPS;n++)
62  {
63  try
64  {
65  foo(0);
66  }
67  catch(int& throw_level)
68  {
69  printf("main catched level %d\n",throw_level);
70  }
71  }
72 #if !defined(_M_AMD64) && !defined(_M_ARM) && !defined(_M_ARM64)
74 #endif
75 
76  //printf("Exceptions per sec %lf\n",(double)(NLOOPS*MAX_REC)/((double)(end.QuadPart-start.QuadPart)/(double)freq.QuadPart));
77 }
GLdouble n
Definition: glext.h:7729
#define NLOOPS
BOOL WINAPI QueryPerformanceFrequency(OUT PLARGE_INTEGER lpFrequency)
Definition: perfcnt.c:45
GLuint GLuint end
Definition: gl.h:1545
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
GLuint start
Definition: gl.h:1545
void foo(int level)
#define printf
Definition: config.h:203