forked from shlagbaum/quantlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtracing_example.cpp
More file actions
50 lines (34 loc) · 765 Bytes
/
Copy pathtracing_example.cpp
File metadata and controls
50 lines (34 loc) · 765 Bytes
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
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <ql/quantlib.hpp>
using namespace QuantLib;
namespace Foo {
int bar(int i) {
QL_TRACE_ENTER_FUNCTION;
QL_TRACE_VARIABLE(i);
if (i == 42) {
QL_TRACE_LOCATION;
QL_TRACE("Right answer, but no question");
} else {
QL_TRACE_LOCATION;
QL_TRACE("Wrong answer");
i *= 2;
}
QL_TRACE_VARIABLE(i);
QL_TRACE_EXIT_FUNCTION;
return i;
}
}
int foo(int i) {
using namespace Foo;
QL_TRACE_ENTER_FUNCTION;
int j = bar(i);
int k = bar(j);
QL_TRACE_EXIT_FUNCTION;
return k;
}
int main() {
QL_TRACE_ENABLE;
QL_TRACE_ENTER_FUNCTION;
int i = foo(21);
QL_TRACE_EXIT_FUNCTION;
return 0;
}