Translation of C function pointer.

BCS none at anon.com
Thu Sep 16 19:21:13 PDT 2010


Hello Steven,

> On Thu, 16 Sep 2010 10:06:24 -0400, BCS <none at anon.com> 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!
>> 
> I'd have to say, if I wasn't able to use D to do this, it would have
> taken  me hours to figure this one out.  Even knowing what it is now,
> I still  can't read it :)
> 

The trick is that function pointers are best read from the inside out.
-- 
... <IXOYE><





More information about the Digitalmars-d-learn mailing list