Article View: gnu.g++.help
Article #338Follow up to "suppressing this ptr"
From: brian hawley
Date: Mon, 10 Dec 1990 08:02
Date: Mon, 10 Dec 1990 08:02
45 lines
2506 bytes
2506 bytes
A short bit ago, I posted a message looking for information on ways
to get around the implicit passing of the "this pointer" when you
invoke member functions.
I've had several questions since, so I want to clarify.
Yes, I do plan to modify the data, but I can actually pass the
instance as an argument to the member function, so I can get
at the data fields that way. What is screwing me up is that
I do not wish to cast these void *'s that I'm pulling off a
queue to their respective classes (which would solve the problem
yes, because then I would be calling the function as a member,
rather than directly). The reason I do not wish to do this, is
because there are many many types of classes on this queue, and
I would prefer not to do a load of casts. That is why I put
the address of the member function I wanted to invoke in the
data structure that goes on the queue (the pointer to the instance
is there also).
I don't care if the "this pointer" is supressed, or a dummy is passed,
(or perhaps some other method), I just don't want to make a mess
out of the stack.
It seems that this problem is related to the other I posted, which
was in regards to placing signal handlers in classes. Again,
the kernal doesn't shove the "this" pointer on the stack when
it invokes a signal handler. So basically, these two problems
are equivolent. How to call a member function, without going
through the instance (i.e. directly, as a regular function call),
without screwing up the stack.
Since the problem seems to be prevalent (from the requests I've
gotten inquiring if I've gotten any information yet), I'll post
a summary (after I verify they work), once I've gotten at least
one idea that works.
Thanks,
Brian
------------------------------------------------------------------------------
Brian N. Hawley Internet: hawley@ucrmath.ucr.edu
Dept. of Math & Computer Science uucp: {ucsd, uci}!ucrmath!hawley
Univ. of Calif., Riverside, CA 92521 phone: (714) 787-4645
Technical Details
Message-ID:
<10422@ucrmath.ucr.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucrmath!ucrmath.ucr.eduShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!ucrmath!ucrmath.ucr.edu From: hawley@ucrmath.ucr.edu (brian hawley) Newsgroups: gnu.g++.help,comp.lang.c++,comp.std.c++ Subject: Follow up to "suppressing this ptr" Message-ID: <10422@ucrmath.ucr.edu> Date: 10 Dec 90 08:02:42 GMT Sender: hawley@ucrmath.ucr.edu Followup-To: gnu.g++.help Organization: University of California, Riverside Lines: 45