On Sunday, 9 February 2014 at 04:14:05 UTC, Marco Leise wrote:
It depends on what syntax you expect. I solved it this way:

void fun(alias length)(void* sneaky = alloca(length));

void foo()
{
    size_t myLength = 42;
    fun!myLength();
}

It defeats the point of alloca if the chunk size has to be known at compile-time. You could just use a void-initialized fixed-length array at that point.

Reply via email to