Optional extra return value? Multiple return values with auto?
Era Scarecrow
rtcvb32 at yahoo.com
Tue Aug 14 18:46:40 PDT 2012
On Wednesday, 15 August 2012 at 01:42:11 UTC, Ali Çehreli wrote:
> Agreed. The function code must be compiled to use certain
> amount of data from the program stack for that particular
> parameter. That size of that parameter must be known at compile
> time.
>
> The compiler could in theory examine the entire program to
> determine a type for the parameter but the separate compilation
> model would preclude it.
Although if you used a template you could pull it off... I
think... But you'd need the sources for that.
void multiOut(T)(out T outType) {
outType = 100;
}
int a;
char b;
multiOut(a);
multiOut(b);
assert(a == 100);
assert(b == 100);
More information about the Digitalmars-d-learn
mailing list