Array void init
deadalnix
deadalnix at gmail.com
Sat Apr 27 06:43:58 PDT 2013
On Saturday, 27 April 2013 at 05:29:41 UTC, 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
That is an implementation detail.
More information about the Digitalmars-d
mailing list