Phobos for Review: std.buffer.scopebuffer

Walter Bright newshound2 at digitalmars.com
Sat Feb 8 02:13:18 PST 2014


On 2/7/2014 4:59 PM, Andrei Alexandrescu wrote:
> 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 think there's a bit of a problem in how the user specifies the 42?



More information about the Digitalmars-d mailing list