annotate run/a/array_initialization_17_B.d @ 1489:b8c0195059d9

changed nntp: URLs to http: URLs
author thomask
date Mon, 09 Apr 2007 13:47:01 +0000
parents 03b5056496f1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
585
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
1 // $HeadURL$
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
2 // $Date$
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
3 // $Author$
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
4
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
5 // @author@ Stewart Gordon <smjg_1998@yahoo.com>
607
0e86ed849adc fixed meta data entries
thomask
parents: 585
diff changeset
6 // @date@ 2005-06-14
1489
b8c0195059d9 changed nntp: URLs to http: URLs
thomask
parents: 1089
diff changeset
7 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=4300
585
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
8 // @desc@ misplaced initialisers in static rectangular array
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
9
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
10 module dstress.run.a.array_initialization_17_B;
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
11
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
12 const float[6] arr = [
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
13 1: 1.0f, 2.0f,
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
14 4: 4.0f
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
15 ];
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
16
870
38ea1bb385b6 bit -> bool and __DSTRESS_TORTURE_BLOCK__ fixes
thomask
parents: 607
diff changeset
17 bool equal(float a, float b){
585
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
18 byte* aa = cast(byte*) &a;
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
19 byte* bb = cast(byte*) &b;
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
20
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
21 for(int index=0; index<a.sizeof; index++){
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
22 if(*aa != *bb)
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
23 return false;
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
24 aa++;
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
25 bb++;
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
26 }
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
27
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
28 return true;
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
29 }
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
30
1089
03b5056496f1 pre DMD-0.163 review
thomask
parents: 1086
diff changeset
31 int main(){
1086
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
32 if(!equal(arr[0], float.nan)){
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
33 assert(0);
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
34 }
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
35 if(arr[1] != 1.0f){
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
36 assert(0);
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
37 }
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
38 if(arr[2] != 2.0f){
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
39 assert(0);
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
40 }
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
41 if(!equal(arr[3], float.nan)){
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
42 assert(0);
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
43 }
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
44 if(arr[4] != 4.0f){
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
45 assert(0);
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
46 }
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
47 if(!equal(arr[5], float.nan)){
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
48 assert(0);
7e8e5013a030 gdc-0.19 review
thomask
parents: 870
diff changeset
49 }
585
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
50
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
51 return 0;
01940e31c0f1 misplaced initialisers in static rectangular array
thomask
parents:
diff changeset
52 }