Array void init
Timon Gehr
timon.gehr at gmx.ch
Sat Apr 27 03:21:00 PDT 2013
On 04/27/2013 07:29 AM, Steven Schveighoffer wrote:
> On Fri, 26 Apr 2013 07:58:34 -0700, Luís Marques <luismarques at gmail.com>
> wrote:
>
>> Should this be supported?
>>
>> double[8] foo = [1.0, 2.0, void, 3.0, 3.5, void, void, void];
>>
>> (it's not supported at the moment)
>
> Have you considered what this does? Consider a standard [1.0, 2.0] call:
>
> In essence, it pushes 1.0 and 2.0 onto the stack, then calls a function
> to allocate the memory and use the given data.
>
> What will end up happening is the data is copied from the stack to the
> heap. It's just in your case, the data copied is garbage. I see little
> point in supporting this.
>
> -Steve
(This is a DMD performance bug.)
More information about the Digitalmars-d
mailing list