null Vs [] return arrays
bearophile
bearophileHUGS at lycos.com
Sun Mar 27 11:42:47 PDT 2011
Kagamin:
> [] is not null, it's an array of 0 elements, what is done exactly.
> edx points to the allocated array.
I don't understand what you say. I think the caller of foo() and bar() receive the same thing, two empty registers. I think that cast(int[])null and cast(int[])[] are the same thing for D.
void main() {
assert(cast(int[])null == cast(int[])null);
auto a1 = cast(int[])null;
a1 ~= 1;
auto a2 = 1 ~ cast(int[])null;
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list