Re: C++ - function pointers as a static data member.
I'm not returning a pointer to a private function. I have a function pointer as a private static data member.
The cGetLength function is the implementation (in plain C/C++). The argument v to cGetLength is being used in place of the this pointer (note that the implementation has one more variable than the inlined method that calls the function pointer). Eventually there will be an sseGetLength and possibly an amd3DNowGetLength. Also an initGetLength which calls my CPU testing code on the first run and picks the appropriate implementation for future calls.
I actually solved this about 45 minutes ago by altering the declaration*. Apparently there's a mess in C++ what's a member function pointer and what's a normal function pointer. What I've defined there is the former when it needs to be the latter. It passes the test suite now so either god is fiddling the values or it works.
* float (*O3DMVector::getLengthPtr)(O3DMVector &) = &cGetLength;
|