This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ compiling errors.


Hi, i'm not on this list, so plz direct replies to me.

I'm using egcs 1.0.3 on a linux 2.0.34 debian 2.0 (hamm) beta.

I get this annoying little error.
g++ -ggdb -Wall -c -DDEBUG -DVERSION=\"services0.8\" -DNOFORK infoserv.cc
infoserv.cc: In method `void InfoService::msgfrom(class aNick *, char *)':
infoserv.cc:97: must use .* or ->* to call pointer-to-member function in
`function (...)'

The error doesn't make sense given the code.

Function names and their pointers are put into a hash to call them.

typedef void (InfoService::*isfunc)(aNick *from, char *params);

The code

  ISParse *blah = (ISParse *)ishash[what];  // Extract from hash
  if(blah) { // If it's there
    isfunc function = blah->func; // assign the function to a function pointer.
    function(n, params); // Call function with current object.
  }

This compiles fine under gcc2, and works perfectly.
Trying to figure out above error, I tried this->*function, this->function,
this.function, this.*function, and none of them compiled.

Please advise...

--- TazQ, God of Insanity, Co-Wielder of Doot, & Technical Director of
    Twilight Dootistries.

Warning: This email is for informational purposes only.  Do not ingest,
digest, reject, inject, deject, osmose or otherwise process this email.
If taken internally, seek psychiatric help immediately.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]