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_UNCAUGHT_EXCEPTION.cpp
Go to the documentation of this file.
1
// checking for std::uncaught_exception()
2
3
25
#include "config.h"
26
27
28
#ifndef _RWSTD_NO_HONOR_STD
29
# ifdef _RWSTD_NO_STD_TERMINATE
30
# include "
terminate.h
"
31
# endif
// _RWSTD_NO_STD_TERMINATE
32
#endif
// _RWSTD_NO_HONOR_STD
33
34
35
// will fail if namespaces aren't supported
36
namespace
std
{
37
38
// looking for a definition in compiler support library
39
bool
uncaught_exception
();
40
41
}
42
43
// will cause an error if namespace std isn't being honored
44
bool
(*
uncaught_exception
)();
45
46
bool
foo
() {
return
false
; }
47
48
bool
uncaught
;
49
50
struct
S
{
51
~S
() {
52
uncaught
= (*uncaught_exception)();
53
}
54
};
55
56
57
int
main
(
int
argc,
char
*argv[])
58
{
59
(void)&argv;
60
61
int
result
= 0;
62
63
if
(argc > 1)
64
uncaught_exception
= &std::uncaught_exception;
65
else
66
uncaught_exception
=
foo
;
67
68
if
((*
uncaught_exception
)())
69
result
=
result
<< 1 + 1;
70
71
#ifndef _RWSTD_NO_EXCEPTIONS
72
73
try
{
74
S
s
;
75
76
// do not actually invoke uncaught_exception()
77
// unless at least one command-line argument
78
// is specified (done to prevent the compiler
79
// from optimizing the function call away)
80
if
(argc > 1)
81
throw
0;
82
}
83
catch
(...) {
84
}
85
86
#endif
// _RWSTD_NO_EXCEPTIONS
87
88
if
(
uncaught
)
89
result
=
result
<< 1 + 1;
90
91
return
result
;
92
}
s
#define s
Definition
rw_alg_test.h:221
result
volatile int result
Definition
18.limits.traps.stdcxx-624.cpp:35
main
#define main
Definition
BAD_ALLOC_COPY_CTOR.cpp:32
uncaught
bool uncaught
Definition
GLOBAL_UNCAUGHT_EXCEPTION.cpp:39
uncaught_exception
bool(* uncaught_exception)()
Definition
STD_UNCAUGHT_EXCEPTION.cpp:44
uncaught
bool uncaught
Definition
STD_UNCAUGHT_EXCEPTION.cpp:48
foo
bool foo()
Definition
STD_UNCAUGHT_EXCEPTION.cpp:46
std
Definition
json.h:5363
bool
#define bool
Definition
stdbool.h:24
S
Definition
COLLAPSE_TEMPLATE_STATICS.cpp:40
S::~S
~S()
Definition
STD_UNCAUGHT_EXCEPTION.cpp:51
terminate.h
Generated by
1.9.8