April 10, 2007 odd result from writefln on int[][] | ||||
---|---|---|---|---|
| ||||
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); } |
April 10, 2007 Re: odd result from writefln on int[][] | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bradley Smith | 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
|
Copyright © 1999-2021 by the D Language Foundation