ADTast-experimentalpthread-emulation
Last change
on this file since d895e32 was
d00d581,
checked in by Henry Xue <y58xue@…>, 3 years ago
|
Update exception tests to use new syntax
|
-
Property mode set to
100644
|
File size:
734 bytes
|
Line | |
---|
1 | // Test exceptions that add data but no functionality. |
---|
2 | |
---|
3 | exception paired { |
---|
4 | int first; |
---|
5 | int second; |
---|
6 | }; |
---|
7 | |
---|
8 | vtable(paired) paired_vt; |
---|
9 | |
---|
10 | const char * virtual_msg(paired * this) { |
---|
11 | return this->virtual_table->msg(this); |
---|
12 | } |
---|
13 | |
---|
14 | int main(int argc, char * argv[]) { |
---|
15 | paired except = {&paired_vt, 3, 13}; |
---|
16 | |
---|
17 | try { |
---|
18 | throw except; |
---|
19 | } catch (paired * exc) { |
---|
20 | printf("%s(%d, %d)\n", virtual_msg(exc), exc->first, exc->second); |
---|
21 | ++exc->first; |
---|
22 | } |
---|
23 | |
---|
24 | printf("%s(%d, %d)\n", virtual_msg(&except), except.first, except.second); |
---|
25 | |
---|
26 | try { |
---|
27 | throwResume except; |
---|
28 | } catchResume (paired * exc) { |
---|
29 | printf("%s(%d, %d)\n", virtual_msg(exc), exc->first, exc->second); |
---|
30 | ++exc->first; |
---|
31 | } |
---|
32 | |
---|
33 | printf("%s(%d, %d)\n", virtual_msg(&except), except.first, except.second); |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.