source:
doc/theses/andrew_beach_MMath/code/cross-catch.cfa@
8ee4475
| Last change on this file since 8ee4475 was ee23a8d, checked in by , 4 years ago | |
|---|---|
|
|
| File size: 635 bytes | |
| Rev | Line | |
|---|---|---|
| [ea593a3] | 1 | // Cross a Try Statement with a Termination Handler |
| [ee23a8d] | 2 | #include <clock.hfa> |
| [ea593a3] | 3 | #include <exception.hfa> |
| [ee23a8d] | 4 | #include <fstream.hfa> |
| [ea593a3] | 5 | #include <stdlib.hfa> |
| 6 | ||
| 7 | EHM_EXCEPTION(not_raised_exception)(); | |
| 8 | ||
| 9 | int main(int argc, char * argv[]) { | |
| 10 | unsigned int times = 1; | |
| 11 | unsigned int total_frames = 1; | |
| [ee23a8d] | 12 | if (1 < argc) { |
| [ea593a3] | 13 | times = strtol(argv[1], 0p, 10); |
| 14 | } | |
| [ee23a8d] | 15 | if (2 < argc) { |
| [ea593a3] | 16 | total_frames = strtol(argv[2], 0p, 10); |
| 17 | } | |
| 18 | ||
| [ee23a8d] | 19 | Time start_time = time(); |
| [ea593a3] | 20 | for (unsigned int count = 0 ; count < times ; ++count) { |
| 21 | try { | |
| 22 | // ... | |
| 23 | } catch (not_raised_exception *) { | |
| 24 | // ... | |
| 25 | } | |
| 26 | } | |
| [ee23a8d] | 27 | Time end_time = time(); |
| 28 | sout | "Run-Time (ns): " | (end_time - start_time)`ns; | |
| [ea593a3] | 29 | } |
Note:
See TracBrowser
for help on using the repository browser.