On 2/7/14, 3:11 PM, Brad Anderson wrote:
On Friday, 7 February 2014 at 23:10:50 UTC, Walter Bright wrote:
On 2/7/2014 2:14 PM, Brad Anderson wrote:

There's always alloca :)

alloca() cannot be used to allocate stack data in a function enclosing
the current one.

Oh, right. Forgot about that.

You can with a default parameter...

void fun(void* sneaky = alloca(42));

will allocate memory on fun caller's frame and make it available to fun.

I've known this for a while and am not sure whether it's an awesome idiom of the spawn of devil.


Andrei

Reply via email to