ReactOS  0.4.15-dev-1397-g19779b3
rethrow1.cpp
Go to the documentation of this file.
1 // Copyright (c) Microsoft. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for
3 // full license information.
4 
5 #include <stdio.h>
6 int c, d;
7 struct A
8 {
9  int i;
10  A () { i = ++c; printf ("A() %d\n", i); }
11  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
12  ~A() { printf ("~A() %d\n", i); ++d; }
13 };
14 int
15 main ()
16 {
17  try
18  {
19  try
20  {
21  printf ("Throwing 1...\n");
22  throw A();
23  }
24  catch (A)
25  {
26  try
27  {
28  printf ("Throwing 2...\n");
29  throw A();
30  }
31  catch (A)
32  {
33  printf ("Throwing 3...\n");
34  throw;
35  }
36  }
37  }
38  catch (A)
39  {
40  printf ("Caught.\n");
41  }
42  printf ("c == %d, d == %d\n", c, d);
43  return c != d;
44 }
A()
Definition: rethrow1.cpp:10
Definition: ehthrow.cxx:92
A(const A &)
Definition: rethrow1.cpp:11
#define A(row, col)
int i
Definition: ehthrow.cxx:95
int d
Definition: rethrow1.cpp:6
int c
Definition: rethrow1.cpp:6
const GLubyte * c
Definition: glext.h:8905
~A()
Definition: rethrow1.cpp:12
int main()
Definition: rethrow1.cpp:15
#define printf
Definition: config.h:203