annotate run/new_13.d @ 378:e555e1460d7e

added tests for custom allocators
author thomask
date Sat, 02 Apr 2005 10:27:50 +0000
parents
children 9e0847cf535a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
378
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
1 // $HeadURL$
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
2 // $Date$
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
3 // $Author$
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
4
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
5 module dstress.run.new_13;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
6
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
7 extern(C) void* malloc(size_t size);
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
8
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
9 int counter;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
10
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
11 union MyUnion{
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
12 int x;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
13
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
14 new(size_t size){
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
15 counter++;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
16 return malloc(size);
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
17 }
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
18 }
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
19
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
20 int main(){
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
21 assert(counter==0);
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
22 MyUnion m;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
23 m.x=1;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
24 assert(counter==1);
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
25 return 0;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
26 }
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
27