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
OPERATOR_DELETE_PLACEMENT.cpp
Go to the documentation of this file.
1
// checking for operator delete (void*, void*)
2
3
25
#include "config.h"
26
27
#include <
stddef.h
>
28
29
#ifdef _RWSTD_NO_EXCEPTION_SPECIFICATION
30
# define throw()
31
#endif
// _RWSTD_NO_EXCEPTION_SPECIFICATION
32
33
34
#ifndef _RWSTD_NO_HONOR_STD
35
# ifdef _RWSTD_NO_STD_TERMINATE
36
# include "
terminate.h
"
37
# endif
// _RWSTD_NO_STD_TERMINATE
38
#endif
// _RWSTD_NO_HONOR_STD
39
40
41
void
operator
delete
(
void
*,
void
*)
throw
();
42
43
void
foo
(
void
*p0,
void
*
p1
)
throw
() { ::operator
delete
(p0,
p1
); }
44
45
void (*
operator_delete
)(
void
*,
void
*);
46
47
48
int
dtor_calls
;
49
50
struct
S
{
51
int
dummy_;
52
53
~S
() { ++
dtor_calls
; }
54
};
55
56
57
int
main
(
int
argc,
char
*argv[])
58
{
59
(void)&argv;
60
61
int
result
= 0;
62
63
char
buf
[
sizeof
(
S
) + 32];
64
65
void
*p0 =
buf
;
66
67
::operator
delete
(p0, p0);
68
69
if
(0 !=
dtor_calls
)
70
result
= (
result
<< 1) + 1;
71
72
if
(argc > 1)
73
operator_delete
= &
operator
delete
;
74
else
75
operator_delete
= &
foo
;
76
77
operator_delete
(p0, p0);
78
79
if
(0 !=
dtor_calls
)
80
result
= (
result
<< 1) + 1;
81
82
// prevent compilers from optimizing the code above away
83
// without actually ever using the result (unless the
84
// test is invoked with command line arguments)
85
if
(argc > 1)
86
return
result
;
87
88
return
0;
89
}
buf
#define buf
Definition
17.names.cpp:452
p1
#define p1
Definition
17.names.cpp:239
S
#define S
Definition
17.names.cpp:162
result
volatile int result
Definition
18.limits.traps.stdcxx-624.cpp:35
main
#define main
Definition
BAD_ALLOC_COPY_CTOR.cpp:32
dtor_calls
int dtor_calls
Definition
OPERATOR_DELETE_ARRAY_PLACEMENT.cpp:47
operator_delete
void(* operator_delete)(void *, void *)
Definition
OPERATOR_DELETE_PLACEMENT.cpp:45
dtor_calls
int dtor_calls
Definition
OPERATOR_DELETE_PLACEMENT.cpp:48
foo
#define foo(buf, s,...)
Definition
VA_LIST_FUNC_MACRO.cpp:28
stddef.h
S
Definition
COLLAPSE_TEMPLATE_STATICS.cpp:40
S::~S
~S()
Definition
OPERATOR_DELETE_PLACEMENT.cpp:53
terminate.h
Generated by
1.9.8