June 15, 2002 crash | ||||
---|---|---|---|---|
| ||||
Interesting... this small program causes DMD to crash: import intrinsic; public: // VECTOR alias float[2] vector2; float lengthsquared(vector2 a) { return a[0]*a[0]+a[1]*a[1]; } float length(vector2 a) { return sqrt(lengthsquared(a)); } unittest { float n; vector2 a,b,c; a[0]=0; a[1]=1; b[0]=1; b[1]=0; //c[] = a[] + b[]; //c = a - b; //c = a * b; //c = a / b; n = lengthsquared(a); n = length(a); } // POINT typedef vector2 point2; // POINT TO POINT DISTANCE float distance(point2 a, point2 b) { point2 d; d[0] = b[0] - a[0]; d[1] = b[1] - a[1]; return length(d); } unittest { float d; point2 a,b; a[0]=0; a[1]=1; b[0]=1; b[1]=0; d = distance(a,b); } |
Copyright © 1999-2021 by the D Language Foundation