Phobos for Review: std.buffer.scopebuffer

Lars T. Kyllingstad public at kyllingen.net
Fri Feb 7 23:43:05 PST 2014


On Saturday, 8 February 2014 at 00:59:35 UTC, Andrei Alexandrescu 
wrote:
>
> 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.

Quoting the GNU alloca() man page:

"On many systems alloca() cannot be used inside the list of 
arguments of a function call, because the stack space reserved by 
alloca() would appear on the stack in the middle of the space for 
the function arguments."

So... devil spawn, then?


More information about the Digitalmars-d mailing list