Dynamic Sized Stack Frames

dennis luehring dl.soluz at gmx.net
Mon Nov 18 00:16:04 PST 2013


Am 18.11.2013 08:31, schrieb Mike Parker:
> On 11/18/2013 3:03 PM, Jonathan Marler wrote:
>> On Monday, 18 November 2013 at 05:58:25 UTC, Chris Cain wrote:
>
>>> 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 :)
>>
>> Are you serious?  It seems the more I learn about D the more impressed I
>> become.  Thanks for the quick response :)
>
> While D is awesome, alloca is actually a standard C function, which is
> why it's in the core.stdc.stdlib package. You have full access to the C
> standard library from D.
>

alloca is not in the C standard - but most compilers implement it - and 
its not a regular functions cause its reserves space on stack


More information about the Digitalmars-d mailing list