Newbie initial comments on D language - delegate

Don Clugston dac at nospam.com.au
Wed Jan 30 03:17:08 PST 2008


Janice Caron wrote:
> On Jan 30, 2008 8:36 AM, Janice Caron <caron800 at googlemail.com> wrote:
>> On Jan 30, 2008 8:16 AM, Don Clugston <dac at nospam.com.au> wrote:
>>> How do you declare
>>> oldFashionedCFunction() ?
>> The old fashioned way?
>>
>>     extern(C) void (*callback)(int,int);

That's just 'function', using the hideous C syntax.

> Or, for any delegate dg,
> 
>     typeof(dg.funcptr) callback;

That only works if you can have extern(C), extern(Windows) delegates.

The problem is that, because of calling conventions, not all function pointers 
can be expressed by dg.funcptr.

The existing delegates are therefore not a superset of function pointers.



More information about the Digitalmars-d mailing list