void init of out variables

Nicholas Wilson via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 18 23:20:28 PDT 2017


I have a function that takes a large matrix as an out parameter.
Is there a way to do `=void` for an out parameter like there is 
for is for a plain declaration?
enum M = 2600;
void f() {
     float[M] mean = void; // works as expected, mean is left 
uninitialised
}

void g(out float[M][M] corr) // works but assigns twice
{
     corr[] = float.init; // compiler inserted

     // assign to each value of corr
}

//Error: found ')' when expecting '.' following void
void h(out float[M][M] corr = void)
{

}

is there a way to not assign to out variables?


More information about the Digitalmars-d mailing list