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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
486
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
1 // $HeadURL$
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
2 // $Date$
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
3 // $Author$
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
4
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
5 module dstress.run.new_04;
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
6
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
7 extern(C) void* malloc(size_t);
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
8
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
9 byte a;
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
10
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
11 class MyClass{
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
12 byte b;
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
13
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
14 this(byte c){
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
15 b=c;
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
16 }
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
17
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
18 new(size_t size, byte blah){
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
19 void* v=malloc(size);
570
32f7f8ce5e51 updated "===" -> "is" and "!==" to "!(...===...)"
thomask
parents: 486
diff changeset
20 if(v is null){
486
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
21 throw new Exception(null);
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
22 }
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
23 a=blah;
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
24 return v;
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
25 }
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
26 }
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
27
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
28 int main(){
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
29 MyClass m = new(21) MyClass(12);
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
30 assert(m.b==12);
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
31 assert(a==21);
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
32 return 0;
73ac7d1627e0 new(...)
thomask
parents:
diff changeset
33 }