source: src/tests/except-1.c @ 86d5ba7c

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 86d5ba7c was 86d5ba7c, checked in by Andrew Beach <ajbeach@…>, 7 years ago

Added the memory management calls to the exception control flow.

  • Property mode set to 100644
File size: 624 bytes
RevLine 
[86d5ba7c]1// Draft memory management test. (remember -fexceptions)
2
3#include <stdio.h>
4
5int main()
6{
7        try {
8                throw 3;
9        }
10        catch( 3 ) {
11                printf("First Caught\n");
12                try {
13                        throw 4;
14                }
15                catch( 4 ) {
16                        printf("Both Caught\n");
17                }
18        }
19        printf("Part A Complete\n");
20
21        try {
22                try {
23                        throw 2;
24                }
25                catch( 2 ) {
26                        printf("First Catch and rethrow\n");
27                        throw;
28                }
29        }
30        catch( 2 ) {
31                printf("Second Catch\n");
32        }
33        printf("Part B Complete\n");
34
35        try {
36                try {
37                        throw 5;
38                }
39                catch( 5 ) {
40                        printf("Throw before cleanup\n");
41                        throw 6;
42                }
43        }
44        catch( 6 ) {
45                printf("Catch after cleanup\n");
46        }
47        printf("Part C Complete\n");
48}
Note: See TracBrowser for help on using the repository browser.