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

ADT ast-experimental enum forall-pointer-decay jacob/cs343-translation new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since d5f6a14 was ea593a3, checked in by Andrew Beach <ajbeach@…>, 4 years 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.