On 4/21/18 3:57 AM, Uknown wrote:
On Saturday, 21 April 2018 at 07:37:50 UTC, Mike Franklin wrote:
Does D have some way to dynamically allocate on the stack?  I'm looking for something roughly equivalent to the following C code.

int doSomething(size_t len)
{
    char stackBuffer[len + 1];
    doSomethingElse(stackBuffer);
}


The language itself doesn't have something, but you could use `alloca`:

alloca is an intrinsic, and part of the language technically -- it has to be.

Mike, alloca is what you are looking for.

-Steve

Reply via email to