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