Does 'D' language supports 'C' like VLA?
via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 14 01:33:42 PDT 2015
On Tuesday, 14 April 2015 at 08:28:23 UTC, Jacob Carlborg wrote:
> On 2015-04-13 21:29, "Marc =?UTF-8?B?U2Now7x0eiI=?=
> <schuetzm at gmx.net>" wrote:
>
>> This is the best I can come up with currently. I think with a
>> @forceinline attribute, it would be a lot better, assuming
>> `alloca()` is
>> usable inside an inlined method.
>
> If I recall correctly "alloca" can be used as a default
> argument to allocate on the caller stack [1]. If I'm correct
> and that's the case you shouldn't need to use string mixins?
>
> [1] http://forum.dlang.org/post/i1gql2$1k6o$1@digitalmars.com
No. If alloca() ends up within a loop you are in a bad situation.
Keep in mind that alloca is released on function RETURN. Not at
the scope level. VLAs are released at scope level.
More information about the Digitalmars-d
mailing list