20.10.2013 18:25, bearophile пишет:
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.

I'd say the most common case one need a stack-allocated array is a temporary allocation which isn't going to survive end of scope. Even more in such cases for too large for stack data one want to allocate from thread local heap instead of shared one to prevent needless locking. `unstd.memory.allocation.tempAlloc` [1] will do the job. As the one of the most common subcases is a temporary C string creation
`unstd.c.string.tempCString` will help here.

[1] http://denis-sh.bitbucket.org/unstandard/unstd.memory.allocation.html#tempAlloc
[2] http://denis-sh.bitbucket.org/unstandard/unstd.c.string.html#tempCString

--
Денис В. Шеломовский
Denis V. Shelomovskij

Reply via email to