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:
619 bytes
|
Rev | Line | |
---|
[ea593a3] | 1 | // Throw Across Empty Function |
---|
| 2 | #include <exception> |
---|
| 3 | #include <cstdlib> |
---|
| 4 | |
---|
| 5 | struct EmptyException : public std::exception {}; |
---|
| 6 | |
---|
| 7 | void unwind_empty(unsigned int frames) { |
---|
| 8 | if (frames) { |
---|
| 9 | unwind_empty(frames - 1); |
---|
| 10 | } else { |
---|
| 11 | throw (EmptyException){}; |
---|
| 12 | } |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | int main(int argc, char * argv[]) { |
---|
| 16 | unsigned int times = 1; |
---|
| 17 | unsigned int total_frames = 1; |
---|
| 18 | if (2 < argc) { |
---|
| 19 | times = strtol(argv[1], nullptr, 10); |
---|
| 20 | } |
---|
| 21 | if (3 < argc) { |
---|
| 22 | total_frames = strtol(argv[2], nullptr, 10); |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | for (unsigned int count = 0 ; count < times ; ++count) { |
---|
| 26 | try { |
---|
| 27 | unwind_empty(total_frames); |
---|
| 28 | } catch (EmptyException &) { |
---|
| 29 | // ... |
---|
| 30 | } |
---|
| 31 | } |
---|
| 32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.