Variadic Struct Parameter

Ali Çehreli acehreli at yahoo.com
Tue Jan 12 19:42:48 UTC 2021


On 1/12/21 10:44 AM, Jonathan Levi wrote:

 > why does `fun` still compile?

I'm not familiar with that particular syntax, I don't know why it 
compiles, and I don't know why structs are different. :) However, it 
looks very much like the following *slice* syntax:

void fun(S[] s...) {
     writeln(s);
}

In that case, the function receives a slice (to an array on the stack; 
so, do not keep a reference to it). Is that what you want?

Ali



More information about the Digitalmars-d-learn mailing list