Multiple return values...

Timon Gehr timon.gehr at gmx.ch
Sun Mar 11 12:42:12 PDT 2012


On 03/11/2012 08:17 PM, Andrei Alexandrescu wrote:
> If you create a variable of type
> TypeTuple!(ReturnType1, ReturnType2), what's its layout?
>

That is context-dependent:

union U{
     TypeTuple!(int, double) x; // superimposed according to union abi
}

struct S{
     TypeTuple!(int, double) x; // sequential according to struct ABI
}

void foo(){
     TypeTuple!(int, double) x; // two non-overlapping memory areas on 
the stack
}

void bar(TypeTuple!(int, double) x){ // according to function call ABI
     // ...
}

TypeTuple!(int, double) qux(){ // D'oh!
     // ...
}


More information about the Digitalmars-d mailing list