source: doc/theses/andrew_beach_MMath/code/cross-catch.cpp @ ea593a3

enumforall-pointer-decayjacob/cs343-translationnew-ast-unique-expr
Last change on this file since ea593a3 was ea593a3, checked in by Andrew Beach <ajbeach@…>, 12 months ago

First draft of all the exception benchmarks. There is an issue with the Cforall linking.

  • Property mode set to 100644
File size: 400 bytes
Line 
1// Cross a Try Statement with a Termination Handler
2#include <exception>
3#include <cstdlib>
4
5struct NotRaisedException : public std::exception {};
6
7int main(int argc, char * argv[]) {
8        unsigned int times = 1;
9        if (2 < argc) {
10                times = strtol(argv[1], nullptr, 10);
11        }
12
13        for (unsigned int count = 0 ; count < times ; ++count) {
14                try {
15                        // ...
16                } catch (NotRaisedException &) {
17                        // ...
18                }
19        }
20}
Note: See TracBrowser for help on using the repository browser.