Translation of C function pointer.

Stewart Gordon smjg_1998 at yahoo.com
Thu Sep 16 14:58:00 PDT 2010


On 16/09/2010 15:06, BCS wrote:
> Hello Steven,
>
>> // note you can't use void as a parameter type in D
>> void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(/*void*/);
>> pragma(msg, typeof(xDlSym).stringof);
>> outputs:
>>
>> void function() function(sqlite3_vfs*, void*, const const(char*)
>> zSymbol)
>
> D, now with C type un-garbleing!

Perhaps the only excuse for keeping C-style function pointer 
declarations in D.

But since we have htod, we could just as well use it and leave D free to 
get rid of this fossil that leads to a syntactic ambiguity.  Except that 
I've just found htod has a bug meaning it rejects this code.

Stewart.


More information about the Digitalmars-d-learn mailing list