Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
Main Page
Related Pages
Topics
Namespaces
Data Structures
Files
File List
Globals
EXTERNAL_HEADERS
RSL
etc
config
src
STD_EXCEPTION.cpp
Go to the documentation of this file.
1
// checking for class std::exception
2
3
25
#include "config.h"
26
27
#ifndef _RWSTD_NO_HONOR_STD
28
# ifdef _RWSTD_NO_STD_TERMINATE
29
# include "
terminate.h
"
30
# endif
// _RWSTD_NO_STD_TERMINATE
31
#endif
// _RWSTD_NO_HONOR_STD
32
33
34
// will fail if namespaces aren't supported
35
namespace
std
{
36
37
class
exception
{ };
38
39
}
40
41
// force a failure if namespace std isn't honored
42
class
exception
{ };
43
44
45
struct
B
{
virtual
~B
() { } };
46
struct
D1
:
B
{ };
47
struct
D2
:
B
{ };
48
49
int
main
()
50
{
51
D1
d1
;
52
B
&
b
=
d1
;
53
54
try
{
55
// throws [std::] bad_cast
56
D2
&
d2
=
dynamic_cast<
D2
&
>
(
b
);
57
}
58
catch
(
exception
&) {
59
// fail if namespace std isn't honored
60
return
1;
61
}
62
catch
(
std::exception
&) {
63
return
0;
64
}
65
catch
(...) {
66
// fail if cast throws anything other than an std::exception-derivative
67
return
1;
68
}
69
70
// fail if cast doesn't throw
71
return
2;
72
}
d1
#define d1
Definition
17.names.cpp:228
b
#define b
Definition
17.names.cpp:110
d2
#define d2
Definition
17.names.cpp:254
main
int main()
Definition
STD_EXCEPTION.cpp:49
exception
Definition
GLOBAL_EXCEPTION.cpp:34
std::exception
Definition
STD_EXCEPTION.cpp:37
B
Definition
NAMESPACE.cpp:31
std
Definition
json.h:5363
B::~B
virtual ~B()
Definition
STD_EXCEPTION.cpp:45
D1
Definition
GLOBAL_BAD_CAST.cpp:39
D2
Definition
GLOBAL_BAD_CAST.cpp:40
terminate.h
Generated by
1.9.8