Summary: Return [] array
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD

--- Comment #0 from 2011-03-27 14:42:14 PDT ---
A little D2 program:

int[] foo() {
    return [];
int[] bar() {
    return null;
void main() {}

The asm of the two functions, compiling it with DMD 2.052:
dmd -O -release -inline test2.d

_D5test23fooFZAi    comdat
L0:     push    EAX
        mov EAX,offset FLAT:_D11TypeInfo_Ai6__initZ
        push    0
        push    EAX
        call    near ptr __d_arrayliteralT
        mov EDX,EAX
        add ESP,8
        pop ECX
        xor EAX,EAX

_D5test23barFZAi    comdat
        xor EAX,EAX
        xor EDX,EDX

I am not sure, but I think it's better to compile foo() to the same assembly as

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to