Mercurial > projects > dstress
annotate run/new_04.d @ 570:32f7f8ce5e51
updated "===" -> "is" and "!==" to "!(...===...)"
author | thomask |
---|---|
date | Wed, 08 Jun 2005 17:49:15 +0000 |
parents | 73ac7d1627e0 |
children | b3da1b510a19 |
rev | line source |
---|---|
486 | 1 // $HeadURL$ |
2 // $Date$ | |
3 // $Author$ | |
4 | |
5 module dstress.run.new_04; | |
6 | |
7 extern(C) void* malloc(size_t); | |
8 | |
9 byte a; | |
10 | |
11 class MyClass{ | |
12 byte b; | |
13 | |
14 this(byte c){ | |
15 b=c; | |
16 } | |
17 | |
18 new(size_t size, byte blah){ | |
19 void* v=malloc(size); | |
570 | 20 if(v is null){ |
486 | 21 throw new Exception(null); |
22 } | |
23 a=blah; | |
24 return v; | |
25 } | |
26 } | |
27 | |
28 int main(){ | |
29 MyClass m = new(21) MyClass(12); | |
30 assert(m.b==12); | |
31 assert(a==21); | |
32 return 0; | |
33 } |