Article View: net.lang.c++
Article #266Re: Orphaned Response
From: jon
Date: Wed, 23 Jul 1986 16:12
Date: Wed, 23 Jul 1986 16:12
19 lines
1433 bytes
1433 bytes
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
__@/
Technical Details
Message-ID:
<3477@amdahl.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!mit-eddie!genrad!decvax!decwrl!amdcad!amdahl!jonReferences:
<5759@alice.uUCp> <5700001@megamax>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!mit-eddie!genrad!decvax!decwrl!amdcad!amdahl!jon From: jon@amdahl.UUCP Newsgroups: net.lang.c++ Subject: Re: Orphaned Response Message-ID: <3477@amdahl.UUCP> Date: Wed, 23-Jul-86 12:12:09 EDT Article-I.D.: amdahl.3477 Posted: Wed Jul 23 12:12:09 1986 Date-Received: Thu, 24-Jul-86 04:45:03 EDT References: <5759@alice.uUCp> <5700001@megamax> Organization: Amdahl Corp, Sunnyvale CA Lines: 19