odd result from writefln on int[][]

Bill Baxter dnewsgroup at billbaxter.com
Tue Apr 10 03:46:34 PDT 2007


Bradley Smith wrote:
> Why does the writefln of [[1,2,3],[4,5,6]] print [[1,2,3],3]?
> 
> import std.stdio;
> 
> // Ouput:
> // [1,2,3] [4,5,6]
> // [[1,2,3],3]
> void main() {
>   int[][] iaa;
>   int[] ia1;
>   ia1 ~= 1;
>   ia1 ~= 2;
>   ia1 ~= 3;
>   iaa ~= ia1;
> 
>   int[] ia2;
>   ia2 ~= 4;
>   ia2 ~= 5;
>   ia2 ~= 6;
>   iaa ~= ia2;
> 
>   foreach (a; iaa) {
>     writef(a, " ");
>   }
>   writefln();
> 
>   writefln(iaa);
> }

Bug 1000, (or 999 -- I forget which).

--bb


More information about the Digitalmars-d-learn mailing list