[Issue 5710] cannot use delegates as parameters to non-global template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 18 13:58:29 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=5710
--- Comment #31 from Martin Nowak <code at dawg.eu> 2013-11-18 13:58:12 PST ---
(In reply to comment #29)
> #1 is necessary for the multiple-context delegates. But applying same rule for
> existing one-context delegates will add hidden runtime cost against existing
> code.
For single context it's
dg.ptr = cast(void*)c;
For multi-context pointer it's
void*[2] __ctxt = [cast(void*)c, funcThis];
dg.ptr = cast(void*)&__ctxt;
And yes, if the delegate escapes the scope the __ctxt becomes a closure
variable and is heap allocated (dg.ptr will point into the heap).
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list