Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!uwm.edu!lll-winken!elroy.jpl.nasa.gov!ben!richard From: richard@ben.Jpl.Nasa.Gov (Conan the Barbarian) Newsgroups: comp.lang.c++ Subject: pointer to function in varargs arguments Keywords: pointer function varargs Message-ID: <1990Mar19.190923.12448@elroy.jpl.nasa.gov> Date: 19 Mar 90 19:09:23 GMT Sender: news@elroy.jpl.nasa.gov (Usenet) Distribution: usa Organization: Image Analysis Systems Grp, JPL Lines: 35 I am running into a strange problem trying to insert a pointer to a member function in the argument list to a non-member function while running the constructor on an instance of a class. In short the translator gets lost and puts garbage in the call. Sun c++ states that you should use &a::proc for the address of member function proc in class a. This does give the correct value in the debugger but it can not be used in an argument list. I tried moving the address to a temporary pointer. For example if void proc(char*); is the declartation in a, then void (a::*func_ptr)(char*) = &a::proc; should create a pointer to proc which I can insert in the function call proc2(func_ptr); (proc2 is not a member function of a.) The translator returns no errors with the use of the temporary. However, func_ptr is not what it seems. It is not a pointer to proc. It is a "structure" with member f pointing to proc. Except that you may not reference member f. Anybody have any ideas on how to insert the pointer to a member function in a non-member function call inside a constructor for a class? (This is used to register a notifier function in xview. I know c++ and xview don't mix.)