Using delegates

Jason House jason.james.house at gmail.com
Sun Apr 15 12:40:28 PDT 2007


My first use of a delegate is causing a segmentation fault.  I'm 
assuming I'm missing something basic.  Can anyone point me in the right 
direction?

unittest{
   int callCounter=0;
   void increment(){
     callCounter++;
   }
   void delegate() dg = &increment; // Segmentation fault
   ...
}

Replacing the offending line with
void delegate() dg = delegate void() {callCounter++};
doesn't eliminate the segmentation fault.


More information about the Digitalmars-d-learn mailing list