Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / December 2005



Tip: Looking for answers? Try searching our database.

CW10 PPx TimerCallback compile warning

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jan - 03 Dec 2005 16:24 GMT
I'm having trouble setting up a TimerCallback instance. I need multiple
timers in my class, and as you can have only one instance of a Timer
per class instance, I figured I could use the template timer. I based
the code on what little I could find on the topic, on page 58 of
PowerPlant_X_Migration_Guide.pdf, on the IdleTimerCallback sample.

Header and implementation extracted below...

When I compile, I get the following warning:

-----------------
Warning : illegal implicit member pointer conversion
XDialogCapture.cp line 518   mTimerFreeDiskSpace.Install( this,
&DoTimerFreeDiskSpace, ::GetMainEventLoop(), 0.5, 3.0 );
-----------------

The choke seems to be on my DoTimerFreeDiskSpace function.

I've tried to cast it away without any luck. I also can't find any
suitable pragma to wrap the Install function just to shut the compiler
up.

The code builds and runs perfectly, tho. I just want to get rid of the
reported warning.

Any clues, please?

class    DialogCapture :    public Timer
{
public:
                        DialogCapture();
    virtual                ~DialogCapture();

private:
            // Timers
    TimerCallback<DialogCapture> mTimerFreeDiskSpace;

    void                DoTimerFreeDiskSpace();
};

//
---------------------------------------------------------------------------
//    RunDialog
//
---------------------------------------------------------------------------
void
DialogCapture::RunDialog()
{
        // Install Timer instance
    mTimerFreeDiskSpace.Install( this, &DoTimerFreeDiskSpace,
::GetMainEventLoop(), 0.5, 3.0 );
}

//
---------------------------------------------------------------------------
//    DoTimerFreeDiskSpace            [private]
//
---------------------------------------------------------------------------
void
DialogCapture::DoTimerFreeDiskSpace()
{
}
Ben Artin - 03 Dec 2005 20:22 GMT
> Warning : illegal implicit member pointer conversion
> XDialogCapture.cp line 518   mTimerFreeDiskSpace.Install( this,
> &DoTimerFreeDiskSpace, ::GetMainEventLoop(), 0.5, 3.0 );

> class    DialogCapture :    public Timer
> {
[quoted text clipped - 5 lines]
>
>     void                DoTimerFreeDiskSpace();

The callback has to be a static member function, or it has to be outside of the
class.

hth

Ben

Signature

If this message helped you, consider buying an item
from my wish list: <http://artins.org/ben/wishlist>

I changed my name: <http://periodic-kingdom.org/People/NameChange.php>

Michael Hecht - 07 Dec 2005 04:54 GMT
>     mTimerFreeDiskSpace.Install( this, &DoTimerFreeDiskSpace,
> ::GetMainEventLoop(), 0.5, 3.0 );

This is a C++ thing. You need to explicitly qualify the member function
name:

  mTimerFreeDiskSpace.Install( this,
     &DialogCapture::DoTimerFreeDiskSpace, ...
      ===============

--Michael
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.