Casting delegates to void*
Daniel Murphy
yebblies at nospamgmail.com
Wed Mar 13 19:32:38 PDT 2013
"David Nadlinger" <see at klickverbot.at> wrote in message
news:kibnaskimiqnmzziegjo at forum.dlang.org...
> Hi all,
>
> A quick quiz: Does the following function compile, and if yes,
> what will it return?
>
> ---
> void* delegateToPtr(void delegate() dg) {
> return cast(void*)dg;
> }
> ---
>
IIRC dg.ptr will be lowered to this, and that is how the glue layer knows
you want to extract the pointer. My guess is this predates the .ptr
property, and much like the array -> ulong cast, should be squashed.
More information about the Digitalmars-d
mailing list