So I'm trying to clean up some old code for magical weapons, and we have the following line:
x += to_int( call_other(weap, ({ (*f)(), attackers[0] }) ) );
The f variable is a function pointer which is both defined in and owned by the 'weap' object in 99.99% of cases. It is bound to the weapon using bind() whenever possible. This line works, inexplicably. Writing out (*f)() should call the function at that point, replace it with its return value (which is an int), then try to do call_other(weap, ({ 35, attackers[0] }) ) or some such which would return 0 since there's no function named 35. But it doesn't; it works, and adds the return value of the function f to the x variable, though the function does not actually get the attackers[0] as an argument.
I decided to fix this with a more easily read line:
x += to_int( evaluate(f, attackers[0]) );
Which has utterly failed to work, even if I remove the attackers[0] function argument. The function f is never called. So the code that should not be working, is, and the code that should be, is not. I've verified that the f is indeed a function pointer and not a string, double checked the man page and the code for call_other to be sure it cannot accept function pointers or ints as arguments, done several tests, and never gotten an error message. I'm baffled.
Can anyone shed some light on this from another point of view? MudOS v22.2b14, highly modified NM3 lib.