alloca() in D

Mehrdad wfunction at hotmail.com
Fri Aug 5 23:35:58 PDT 2011


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?


More information about the Digitalmars-d mailing list