What's left before we can have array literals?

Jarrett Billingsley kb3ctd2 at yahoo.com
Tue Sep 5 18:51:08 PDT 2006


"Stewart Gordon" <smjg_1998 at yahoo.com> wrote in message 
news:edl274$2m8$3 at digitaldaemon.com...

> But I'm rather puzzled by this claim.  When you call a typesafe variadic 
> function, even when it isn't lazy, is this not effectively an array 
> literal, at least internally?  If it is, then this would mean that we 
> already have the workings towards supporting array literals, and could use 
> them in lazy variadics just the same.   Otherwise, how does it work at the 
> moment?

You're entirely right.  Looking at the disassembly shows it.  Basically the 
compiler creates an array on the stack, fills it with the values at runtime, 
and passes that array to the function.  Of course, this means the data lives 
on the stack, and must be dup'ed in order for it not to be lost. 





More information about the Digitalmars-d mailing list