array concatenation issue, more details

Sönke Ludwig ludwig at informatik_dot_uni-luebeck.de
Tue Mar 18 12:23:31 PDT 2008


Tobias Kieslich schrieb:
> hi,
> 
> 	after some more thinking i figured I'm way to preoccupied with my
> scipting language past. I am concatenating apples and oranges here, it
> seems. So let's go again:
> 
> 	int [2][] y = [[1,2],[3,4]];
> 	writefln("%s --- length: %d", y, y.length );
> 	//y = y ~ [[9,10]]; // fail because concatenate [2u][] with [][1u]
> 	//y = y ~ [9,10]; // success, but wrong result
> 	//y = y ~ cast (int [2]) [9,10]; // success, but wrong result
> 	y = y ~ cast (int [2][]) [[9,10]]; // success, right result
> 
> so a very properly casted array can be concatenated, however, I think
> that this line should produce a proper result as well:
> 	y = y ~ cast (int [2]) [9,10]; // success, but wrong result
> 
> especially because the following fails as well:
> 	int [2][] y = [[1,2],[3,4]];
> 	int [2] yx = [40,50];
> 	y = y ~ yx; // success, but wrong result
> 	writefln("%s --- length: %d", y, y.length );
> 	// [[1 2] [3 4] [40 50] [-1075618328 134587053]] --- length: 4
> 
> 	-Tobias

This sounds like it might be related to 
http://d.puremagic.com/issues/show_bug.cgi?id=1891

At least the output looks quite similar.



More information about the Digitalmars-d mailing list