Dynamic Sized Stack Frames
Chris Cain
clcain at uncg.edu
Sun Nov 17 21:58:24 PST 2013
On Monday, 18 November 2013 at 05:46:48 UTC, Jonathan Marler
wrote:
> However, what if I want the size of the buffer to be
> configurable at runtime?
core.stdc.stdlib has "alloca" ... it allocates a runtime
configurable amount of memory on the stack. There's a few threads
on doing some tricks with it. For instance, if you use it as a
default parameter, then it'll allocate on the caller's stack so
you can actually return a ref to it from the function :)
More information about the Digitalmars-d
mailing list