Skip to main content
GameDev.net gamedev.net
🔒 Locked

GCC, member function pointer and HINSTANCE

Started by DerekSaw Dec 23, 2002 at 6:56 PM 1 replies 350+ views
Original Post
DerekSaw
DerekSaw
Yesterday I got DevC++/GCC3.2. However I can't get this to compile whereas Microsoft/Borland compilers work absolutely fine (no error, no warning... All errors/warnings turn on):
    
class Foo
{
public:
  Foo() { }
  void SomeFunc() { do something }

  Foo& operator<< ( void (Foo::*method)() ) 
  { 
    (this->*method)();
    return *this;
  }
};

Foo foo;
foo << Foo::SomeFunc;  // ok in Microsoft/Borland, but error in GCC.

    
Besides this, I found out that the hInstance member of WNDCLASSEX and WNDCLASS is HANDLE type. Shouldn't it be HINSTANCE type? Nowonder I got this error "unable to convert to 'void*' from 'HINSTANCE__*'".... hmm.... wierd. [EDIT] Miss a bracket. [edited by - DerekSaw on December 23, 2002 8:11:14 PM]
"after many years of singularity, i'm still searching n the event horizon" o
DerekSaw
DerekSaw
Ooops... my typing error. In Microsoft/Borland, it need not require the ''&''. i.e.:
foo << Foo::SomeFunc;
whereas GCC requires:
foo << &Foo::SomeFunc;
...again.. still wierd.
"after many years of singularity, i'm still searching n the event horizon" o

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.