Array operation doesn't check array bounds

simendsjo simen.endsjo at pandavre.com
Sun Apr 3 04:10:37 PDT 2011


	int[] a = [1,2,3];

	int[4] b;
	assert(b == [0,0,0,0]);
	b = a[] * 3; // oops... a[] * 3 takes element outside a's bounds
	assert(b[$-1] == 0); // fails.. last element is *(a.ptr+3) * 3


More information about the Digitalmars-d-learn mailing list