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
EXCEPTION_SPECIFICATION.cpp
Go to the documentation of this file.
1
// checking exception specification
2
3
25
#include "config.h"
26
27
#include <
signal.h
>
28
#include <
stdlib.h
>
29
#include <
stdio.h
>
30
31
#ifndef _RWSTD_NO_HONOR_STD
32
# ifdef _RWSTD_NO_STD_TERMINATE
33
34
namespace
std
{
35
36
void
terminate
()
37
{
38
abort ();
39
}
40
41
}
// std
42
43
# endif
// _RWSTD_NO_STD_TERMINATE
44
#endif
// _RWSTD_NO_HONOR_STD
45
46
extern
"C"
{
47
48
void
handle_ABRT
(
int
)
49
{
50
// exit successfully
51
exit (0);
52
}
53
54
}
// extern "C"
55
56
// test functionality;
57
struct
X
{};
58
struct
Y
{};
59
60
void
foobar
() {
throw
Y
(); }
61
void
foo
() throw (
X
) {
foobar
(); }
62
63
// test syntax
64
void
bar
(
int
)
throw
(
int
) {}
65
66
struct
A
{ };
67
struct
B
68
{
69
B
() throw (
A
*) { }
70
~B
() throw () { }
71
};
72
73
int
main
()
74
{
75
signal (
SIGABRT
,
handle_ABRT
);
76
77
try
{
78
// must not return
79
foo
();
80
}
81
catch
(
X
) {
82
return
1;
83
}
84
catch
(
Y
) {
85
return
2;
86
}
87
catch
(...) {
88
return
3;
89
}
90
91
return
4;
92
}
Y
#define Y
Definition
17.names.cpp:168
bar
int bar()
Definition
collapse_static_locals.lib.cpp:36
foo
void foo()
Definition
EXCEPTION_SPECIFICATION.cpp:61
foobar
void foobar()
Definition
EXCEPTION_SPECIFICATION.cpp:60
main
int main()
Definition
EXCEPTION_SPECIFICATION.cpp:73
handle_ABRT
void handle_ABRT(int)
Definition
EXCEPTION_SPECIFICATION.cpp:48
terminate
void terminate()
SIGABRT
#define SIGABRT
A
Definition
NAMESPACE.cpp:25
B
Definition
NAMESPACE.cpp:31
std
Definition
json.h:5363
signal.h
stdio.h
stdlib.h
B::B
B()
Definition
EXCEPTION_SPECIFICATION.cpp:69
B::~B
~B()
Definition
EXCEPTION_SPECIFICATION.cpp:70
X
Definition
DUMMY_DEFAULT_ARG.cpp:35
Y
Definition
EXCEPTION_SPECIFICATION.cpp:58
Generated by
1.9.8