Function pointer pitfalls

Inquie via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 14 10:05:10 PDT 2017


I am generating member function pointers using the declaration 
specified from a standard member function. The standard member 
function is a valid D function that could use any types.

Is there any pitfalls like there are in C++ from generating a 
function pointer from them?

e.g.,

X foo(A,B,C) @R @S @T -> X function(A,B,C) @R @S @T fooptr;

In my case, there are no attributes, so that might ease the 
burden.

e.g., a template that converts a member function declaration.

ToFunctionPtr!("X foo(A,B,C) @R @S @T)", fooptr)

or

ToFunctionPtr!(foo, fooptr)

gives function pointer declaration who's declaration is the same 
as foo.



More information about the Digitalmars-d-learn mailing list