alloca() in D

Andrew Wiley wiley.andrew.j at gmail.com
Fri Aug 5 23:56:46 PDT 2011


On Fri, Aug 5, 2011 at 11:35 PM, Mehrdad <wfunction at hotmail.com> wrote:

> I think D should really have a friendlier interface to stack-based data
> structures than just alloca() (unless it already does and I don't know about
> it).
>
> Some features which I think would be helpful:
> - An "automatic" array-like structure entirely on the stack that starts out
> with a capacity given by the user), and which switches to the heap if it
> gets too big.
> - A function that can just allocate a structure easily on the stack, taking
> care of constructors and whatnot... something like alloca!Foo() to allocate
> Foo on the stack, and alloca!Foo(5) to allocate Foo[] with a length of 5 on
> the stack (NOT Foo[5], obviously...), etc.
>
> How does this sound?
>

http://d-programming-language.org/phobos/std_typecons.html#scoped
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110805/00c8d30e/attachment-0001.html>


More information about the Digitalmars-d mailing list