[:] as empty associative array literal, plus warning for null
bearophile
bearophileHUGS at lycos.com
Wed Jul 3 11:16:27 PDT 2013
> Telling apart the literal for an empty array from the literal
> of a empty but not null array is a bad idea that muds the
> language. And thankfully this currently fails:
>
> void main() {
> int[] emptyArray = [];
> assert(emptyArray !is null);
> }
But currently this code:
void main() {
int[] emptyArray = [];
}
produces a call to __d_arrayliteralTX, for reasons unknown to me:
_D4temp10emptyArrayFZAi comdat
L0: push EAX
mov EAX,offset FLAT:_D11TypeInfo_Ai6__initZ
push 0
push EAX
call near ptr __d_arrayliteralTX
mov EDX,EAX
add ESP,8
pop ECX
xor EAX,EAX
ret
Bye,
bearophile
More information about the Digitalmars-d
mailing list