More on C++ stack arrays

Lionello Lunesu lionello at lunesu.remove.com
Sun Oct 20 09:18:08 PDT 2013


On 10/20/13 16:25, bearophile wrote:
> More discussions about variable-sized stack-allocated arrays in C++, it
> seems there is no yet a consensus:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3810.pdf
>
> I'd like variable-sized stack-allocated arrays in D.
>
> Bye,
> bearophile

Good read, but many of the problems don't apply to D ;)

The problem is that it'll probably be like using alloca, which doesn't 
get cleaned up until after the function exits. Using it within a loop is 
bound to cause a stack overflow. I wonder if there's something we can do 
to 'fix' alloca in that respect.

L.


More information about the Digitalmars-d mailing list