www.digitalmars.com         C & C++   DMDScript  

D - about array's concatenation

The manual says about array's concatenation :

Concatenation always creates a copy of its operands, even if one of the
operands is a 0 length array, so: 
	a = b			a refers to b
	a = b ~ c[0..0]		a refers to a copy of b
I think it is a very good policy. whereas in the following program , I assume it should be 2. is it a bug? --------------------------------------- int[] a,b,c; a = new int[3]; b = new int[3]; a[1] = 2; c = a ~ b[0..0]; a[1] = 4; printf("%d",c[1]); // result : output 4. --------------------------------------- yaneurao.
Feb 06 2004