digitalmars.D.learn - odd result from writefln on int[][]
- Bradley Smith (23/23) Apr 10 2007 Why does the writefln of [[1,2,3],[4,5,6]] print [[1,2,3],3]?
- Bill Baxter (3/31) Apr 10 2007 Bug 1000, (or 999 -- I forget which).
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); }
Apr 10 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
Apr 10 2007