[DGD] A small patch and..

bart at wotf.org bart at wotf.org
Mon Aug 12 13:47:50 CEST 2013


On another note, I am experiencing another oddity with the function pointers
extension, this might be due to misunderstanding on my side, but it looks odd
to me.

Code like this does not compile (invalid argument 1 to kfun * (needs function):

function fp;

fp = &some_existing_function();
(*fp)();

But the following does compile (and work):

object fp;

fp = &some_existing_function();
(*fp)();

Also, the following works (getting around the compiler's type checking)

mixed * arr;
function fp;

fp = &some_existing_function();
arr = ({ fp });
(*arr[0])();

So this looks like a compiler error. Didn't put much time in debugging it yet,
first wanted to confirm that the first sniplet of code should work or if I'm
misunderstanding something.

kf_call_function wants an object as first argument, that was the first thing I
noticed, but at first glance this makes sense, as function pointer is a
builtin type, and hence an LWO. At runtime this seems to work as I expected.

Bart.

On Mon, 12 Aug 2013 11:51:26 +0200, Felix A. Croes wrote
> Welcome back, Bart!  And thank you for the patches of the last few days.
> 
> Regards,
> Felix Croes
> ____________________________________________
> https://mail.dworkin.nl/mailman/listinfo/dgd


--
http://www.flickr.com/photos/mrobjective/
http://www.om-d.org/




More information about the DGD mailing list