Newbie initial comments on D language - delegate
Edward Diener
eddielee_no_spam_here at tropicsoft.com
Wed Jan 30 15:24:01 PST 2008
Janice Caron wrote:
> On 1/30/08, Edward Diener <eddielee_no_spam_here at tropicsoft.com> wrote:
>> You might need plain function pointers but you do not need 'function'. A
>> 'delegate' which encompassed a 'function', with the object pointer part
>> of the delegate being null in that particle case, should be implicitly
>> convertible to a C function pointer.
>
> In general, the compiler cannot tell at compile time whether or a not
> a value is null at runtime (though in an expression like &f it
> obviously can), so I don't think it can be quite that automatic.
But it can generate code which checks at run-time if this is the case
and takes the correct action. In the case of converting a delegate which
has a non-null value as the object pointer, the code generated if one
tries to cast it to a plain C function pointer could throw an exception.
More information about the Digitalmars-d
mailing list