help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

can no longer use pointers to submethods


From: Brent Phillips
Subject: can no longer use pointers to submethods
Date: Tue, 06 Feb 2001 21:19:34 -0800

Hi,

I'm having a new problem after upgrading my compiler from 2.95.1 to 2.96-69
(along with a general upgrade to RedHat 7.0 and glibc 2.2). What worked
fine in 2.95.1 is now broken in 2.96-69. :(

I'm using method pointers in a message handling system; the typedef is as
follows: (I've changed the names for better readability)

typedef void (A::*MsgHandler)(LmSrvMesgBuf* msgbuf, LmConnection* conn);

(I think The types LmSrvMesgBuf* and LmConnection* are irrelevant - they
could be int's. I think!)

Now, class B is a subclass of class A. In class B, I use the following call:

RegisterHandler(SMsg::RECVMESG, (MsgHandler)                                    
        handle_SMsg_RecvMesg);

where handle_SMsg_RecvMesg is a method of class B with the following
prototype:

void handle_SMsg_RecvMesg(LmSrvMesgBuf* msgbuf, LmConnection* conn);

HOWEVER, this creates the following compiler error:

LmMessageReader.cpp: In method `LmMessageReader::LmMessageReader 
(LmDispatch *, LmMesgBufPool *, LmLog *)':
LmMessageReader.cpp:40: no matches converting function 
`handle_SMsg_RecvMesg' to type `void (class LmThread::*) (class 
LmSrvMesgBuf *, class LmConnection *)'
LmMessageReader.h:66: candidates are: void 
LmMessageReader::handle_SMsg_RecvMesg (LmSrvMesgBuf *, LmConnection *)
make: *** [LmMessageReader.o] Error 1

This problem is driving me nuts, because it worked before, and a much
simpler version of the same basic idea works fine with 2.96-69 (pass a
subclass method pointer when the prototype for the function specified a
method pointer to its superclass).

Any suggestions?

thanks in advance

Brent











reply via email to

[Prev in Thread] Current Thread [Next in Thread]