Mercurial > projects > dstress
view run/a/array_initialization_17_C.d @ 607:0e86ed849adc
fixed meta data entries
author | thomask |
---|---|
date | Thu, 21 Jul 2005 19:04:12 +0000 |
parents | 01940e31c0f1 |
children | 38ea1bb385b6 |
line wrap: on
line source
// $HeadURL$ // $Date$ // $Author$ // @author@ Stewart Gordon <smjg_1998@yahoo.com> // @date@ 2005-06-14 // @uri@ news:d8m7rs$mtv$2@digitaldaemon.com // @desc@ misplaced initialisers in static rectangular array module dstress.run.a.array_initialization_17_C; const cfloat[6] arr = [ 1: 1.0f, 2.0f, 4: 4.0f ]; bit equal(cfloat a, cfloat b){ byte* aa = cast(byte*) &a; byte* bb = cast(byte*) &b; for(int index=0; index<a.sizeof; index++){ if(*aa != *bb) return false; aa++; bb++; } return true; } int main(){ assert(equal(arr[0], cfloat.nan)); assert(arr[1]==1.0f); assert(arr[2]==2.0f); assert(equal(arr[3], cfloat.nan)); assert(arr[4]==4.0f); assert(equal(arr[5], cfloat.nan)); return 0; }