ADTast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 55ad35c was
ea593a3,
checked in by Andrew Beach <ajbeach@…>, 3 years ago
|
First draft of all the exception benchmarks. There is an issue with the Cforall linking.
|
-
Property mode set to
100644
|
File size:
720 bytes
|
Line | |
---|
1 | // Conditional Match (or Re-Raise) |
---|
2 | #include <exception.hfa> |
---|
3 | #include <stdlib.hfa> |
---|
4 | |
---|
5 | EHM_EXCEPTION(empty_exception)(); |
---|
6 | |
---|
7 | EHM_VIRTUAL_TABLE(empty_exception, empty_vt); |
---|
8 | |
---|
9 | bool should_catch = false; |
---|
10 | |
---|
11 | void throw_exception() { |
---|
12 | throw (empty_exception){&empty_vt}; |
---|
13 | } |
---|
14 | |
---|
15 | void cond_catch() { |
---|
16 | try { |
---|
17 | throw_exception(); |
---|
18 | } catch (empty_exception * exc ; should_catch) { |
---|
19 | // ... |
---|
20 | } |
---|
21 | } |
---|
22 | |
---|
23 | int main(int argc, char * argv[]) { |
---|
24 | unsigned int times = 1; |
---|
25 | unsigned int total_frames = 1; |
---|
26 | if (2 < argc) { |
---|
27 | times = strtol(argv[1], 0p, 10); |
---|
28 | } |
---|
29 | if (3 < argc) { |
---|
30 | total_frames = strtol(argv[2], 0p, 10); |
---|
31 | } |
---|
32 | |
---|
33 | for (unsigned int count = 0 ; count < times ; ++count) { |
---|
34 | try { |
---|
35 | cond_catch(); |
---|
36 | } catch (empty_exception * exc) { |
---|
37 | // ... |
---|
38 | } |
---|
39 | } |
---|
40 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.