blob: 1a71ea5f3c531b6184b879e33b03c31b315ca14d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
// Bug: new doesn't make sure that the count is an integral value.
typedef __SIZE_TYPE__ size_t;
extern "C" int printf (const char *, ...);
extern "C" void *malloc (size_t);
size_t s;
void * operator new (size_t siz) {
if (s == 0)
s = siz;
else
s = (s != siz);
return malloc (siz);
}
main()
{
s = 0;
float f = 3;
int* b1 = new int[(int)f];
int* b2 = new int[f];
return s;
}
|