Does 'D' language supports 'C' like VLA?

John Colvin via Digitalmars-d digitalmars-d at puremagic.com
Tue Apr 14 00:06:22 PDT 2015


On Monday, 13 April 2015 at 19:45:37 UTC, deadalnix wrote:
> On Monday, 13 April 2015 at 17:04:51 UTC, John Colvin wrote:
>> Eww.
>>
>> auto arr = new int[3];
>>
>> Also, I think he's referring to something slightly different.
>
> IMO, that shouldn't be too difficult to promote that on stack 
> if the reference do not escape in most cases.

The problem is that the size isn't necessarily known. I guess the 
compiler could put in a branch, but at that point you'd probably 
want to give the programmer control and have a way of making it 
explicit.


More information about the Digitalmars-d mailing list