Often repeated array allocations

Jacob Carlborg doob at me.com
Sun Jul 21 02:16:44 PDT 2013


On 2013-07-21 08:45, Namespace wrote:
> But D isn't like Ada. It's more like C++ and there Heap allocations is
> often used too.
> It would be really cool if we had allocators already.
> Something like:
> ----
> with (AllocatorX) { /// will use malloc and free instead of calling the GC
>      float[] arr;
>      arr ~= 42;
> }
> ----
>
> And I still don't know what a 'TLS scratch pad buffer' is.

Perhaps:

float[4000] scratchPadBuffer;

void foo ()
{
     // use scratchPadBuffer here
}

I guess he just refers to a some temporary data you need during the 
execution of a function and at the end of the function you don't care 
about it.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list