Last change
on this file since cf34e82 was
3bf9d10,
checked in by Peter A. Buhr <pabuhr@…>, 17 months ago
|
change printf to sout
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | // Finally Clause Tests |
---|
2 | |
---|
3 | #include <fstream.hfa> |
---|
4 | #include "except-io.hfa" |
---|
5 | |
---|
6 | exception myth {}; |
---|
7 | |
---|
8 | vtable(myth) myth_vt; |
---|
9 | |
---|
10 | int main(int argc, char * argv[]) { |
---|
11 | myth exc = {&myth_vt}; |
---|
12 | |
---|
13 | try { |
---|
14 | try { |
---|
15 | sout | "termination throw"; |
---|
16 | throw exc; |
---|
17 | } finally { |
---|
18 | loud_exit a = "termination inner finally"; |
---|
19 | sout | "finally during unwind"; |
---|
20 | } |
---|
21 | } catch (myth * error) { |
---|
22 | sout | "termination catch"; |
---|
23 | } finally { |
---|
24 | loud_exit a = "termination outer finally"; |
---|
25 | sout | "finally after catch"; |
---|
26 | } |
---|
27 | sout | nl; |
---|
28 | |
---|
29 | try { |
---|
30 | try { |
---|
31 | sout | "resumption throw"; |
---|
32 | throwResume exc; |
---|
33 | } finally { |
---|
34 | loud_exit a = "resumption inner finally"; |
---|
35 | sout | "finally after resume"; |
---|
36 | } |
---|
37 | } catchResume (myth * error) { |
---|
38 | sout | "resumption catch"; |
---|
39 | } finally { |
---|
40 | loud_exit a = "resumption outer finally"; |
---|
41 | sout | "finally after catch"; |
---|
42 | } |
---|
43 | sout | ""; |
---|
44 | |
---|
45 | try { |
---|
46 | sout | "walking out of try"; |
---|
47 | } finally { |
---|
48 | loud_exit a = "walking finally"; |
---|
49 | sout | "walking through finally"; |
---|
50 | } |
---|
51 | sout | ""; |
---|
52 | |
---|
53 | try { |
---|
54 | sout | "jumping out of try"; |
---|
55 | goto endoffunction; |
---|
56 | } finally { |
---|
57 | loud_exit a = "jumping finally"; |
---|
58 | sout | "jumping through finally"; |
---|
59 | } |
---|
60 | endoffunction: |
---|
61 | ; |
---|
62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.