Array append performance 2
bearophile
bearophileHUGS at lycos.com
Sun Aug 31 08:31:42 PDT 2008
Christian Kamm:
> Actually, I don't think the D spec requires typeof(T.init) == T.
Maybe the D specs have to be fixed then.
> And T is a valid initializer for T[N]:
Right, but the following program:
import std.stdio: writefln;
void main() {
alias int[2] T;
writefln(T.init);
int[2] T_init;
writefln(T_init);
}
prints:
0
[0,0]
So if I have a dynamic array of static arrays (where T is the static array) I can't do this:
array[0 .. $][] = T.init;
I have to do:
T T_init;
array[0 .. $][] = T_init;
While if T is a dynamic array I can do:
array[0 .. $] = T.init;
So even if they aren't bugs I don't like all such differences much...
Bye,
bearophile
More information about the Digitalmars-d
mailing list