Does this allocate?

ponce contact at gam3sfrommars.fr
Sun Mar 23 16:01:57 PDT 2014


I'm wondering if a delegate which theoretically doesn't need to 
make a heap closure, might allocate anyway.
Somehow I don't want to assume the compiler will do the 
non-allocating way.

This is the code I wrote:
---

     bool feed(float x, Complex!float[] fftData)
     {
         void processSegment(float[] segment)
         {
             fftData.length = _fftSize; // we do need the delegate 
context here

             /* do stuff with segment and fftData */
         }

         // _analyzer.feed takes a void delegate(float[]) as 
parameter
         // will this line allocate?
         return _analyzer.feed(x, &processSegment);
     }

---

Does the last line allocate?


More information about the Digitalmars-d-learn mailing list