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_ARRAY_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
#ifndef _RWSTD_NO_HONOR_STD
34
# ifdef _RWSTD_NO_STD_TERMINATE
35
# include "
terminate.h
"
36
# endif
// _RWSTD_NO_STD_TERMINATE
37
#endif
// _RWSTD_NO_HONOR_STD
38
39
40
void
operator
delete
[] (
void
*,
void
*)
throw
();
41
42
void
foo
(
void
*p0,
void
*
p1
)
throw
() { ::operator
delete
[] (p0,
p1
); }
43
44
void (*
op_delete_array
)(
void
*,
void
*);
45
46
47
int
dtor_calls
;
48
49
struct
S
{
50
int
dummy_
;
51
52
~S
() { ++
dtor_calls
; }
53
};
54
55
56
int
main
(
int
argc,
char
*argv[])
57
{
58
(void)&argv;
59
60
int
result
= 0;
61
62
char
buf
[
sizeof
(
S
) + 32];
63
64
void
*p0 =
buf
;
65
66
::operator
delete
[] (p0, p0);
67
68
if
(0 !=
dtor_calls
)
69
result
= (
result
<< 1) + 1;
70
71
if
(argc > 1)
72
op_delete_array
= &
operator
delete
[];
73
else
74
op_delete_array
= &
foo
;
75
76
op_delete_array
(p0, p0);
77
78
if
(0 !=
dtor_calls
)
79
result
= (
result
<< 1) + 1;
80
81
// prevent compilers from optimizing the code above away
82
// without actually ever using the result (unless the
83
// test is invoked with command line arguments)
84
if
(argc > 1)
85
return
result
;
86
87
return
0;
88
}
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
op_delete_array
void(* op_delete_array)(void *, void *)
Definition
OPERATOR_DELETE_ARRAY_PLACEMENT.cpp:44
dtor_calls
int dtor_calls
Definition
OPERATOR_DELETE_ARRAY_PLACEMENT.cpp:47
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_ARRAY_PLACEMENT.cpp:52
S::dummy_
int dummy_
Definition
OPERATOR_DELETE_ARRAY_PLACEMENT.cpp:50
terminate.h
Generated by
1.9.8