Converting function to delegate - was Re: How to know whether to use function or delegate

BCS BCS at pathlink.com
Tue Jul 25 12:05:56 PDT 2006


Frits van Bommel wrote:
> Chris Miller wrote:
> 
>> Isn't there an easier way to directly convert a function to a delegate?
> 
> 
> Ehm, how about this:
> 
>     mydelegate = { somethingStatic(); };
> 
> Seems pretty easy to me. Gotta love that new delegate syntax. :)
> Gets a bit uglier once you add arguments though (especially if there are 
> more than a few).


for(int i=0; i<0x100000 i++)
	mydelegate();

lot-o-overhead. Copy all args to new stack frame, call-return, etc. 
Making a re-wrap-args and goto stub will save a bunch of time.



More information about the Digitalmars-d mailing list