eric@megamax (07/19/86)
What happens when a pointer to a member function is passed to a non-C++ subroutine (eg. qsort). How does qsort know to pass the object instance back to the member function (so "this" is set up properly)? Eric Parker eric@megamax convex!ctvax!megamax!eric
jon@amdahl.UUCP (07/23/86)
In article <5700001@megamax>, eric@megamax writes: > > What happens when a pointer to a member function is passed to a non-C++ > subroutine (eg. qsort). How does qsort know to pass the object instance > back to the member function (so "this" is set up properly)? Qsort doesn't know. You have to go indirectly through a non-member function (called from qsort) which is given pointers to the two class members being compared. It can then call the member function to do comparision or whatever. This is essentially the same problem someone was having with signal() - Unix library routines don't know anything about C++ calling conventions. If you were willing to restrict the domain of qsort to classes with a virtual comparison function, it could be rewritten to call the member functions directly. -- Jon Leech (...seismo!amdahl!jon || jon@csvax.caltech.edu) UTS Products / Amdahl Corporation __@/