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

2015-04-13 Thread BS LD via Digitalmars-d
On Monday, 13 April 2015 at 17:32:31 UTC, Dmitri Makarov wrote: On Monday, 13 April 2015 at 17:24:05 UTC, Dylan Knutson wrote: On Monday, 13 April 2015 at 17:20:04 UTC, Dmitri Makarov wrote: This should work the way you want it to: void main() { immutable size_t szArr = 3; int[szArr] arr;

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

2015-04-13 Thread BS LD via Digitalmars-d
On Monday, 13 April 2015 at 17:02:13 UTC, CraigDillabaugh wrote: On Monday, 13 April 2015 at 16:53:55 UTC, BS LD wrote: As you know in 'C' you can create a variable-length-array using variably modified type and a run-time variable allocating a storage for it - the same way for any local

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

2015-04-13 Thread BS LD via Digitalmars-d
On Monday, 13 April 2015 at 17:24:38 UTC, Steven Schveighoffer wrote: On 4/13/15 12:53 PM, BS LD wrote: As you know in 'C' you can create a variable-length-array using variably modified type and a run-time variable allocating a storage for it - the same way for any local (normally using the

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

2015-04-13 Thread BS LD via Digitalmars-d
As you know in 'C' you can create a variable-length-array using variably modified type and a run-time variable allocating a storage for it - the same way for any local (normally using the stack). However in 'D' I don't see such feature. Code like this fails: void main() { size_t szArr =