Hi,
In C++, every member function has an implicit initial argument that takes
the value of this. In your case, Member1 actually has two arguments of
MyObject* this and EventPtr pEvent. When you write
myObject->Member1(pEvent), the compiler actaul compiles
MyObject::Member1(myObject, pEvent). Somehow, it seems that your Member2()
statement is being compiled as MyObject::Member2(pEvent) instead of
MyObject::Member2(this). This would be a compiler bug; which I would doubt
because I have similar C++ code which is OK for me. It's more likely that
this is also pEvent in Member1, is this the case? If so, how are you calling
Member1 from PilotMain?
Cheers,
James.
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Werner
> Poschenrieder
> Sent: Tuesday, 28 August 2001 02:42
> To: Palm Developer Forum
> Subject: C++ this - pointer gone lost
>
>
> Code Warrior light V4.0.1, Target = PalmOS
> PalmOS 3.5
> ROM-Image IIIe
>
> SysAppCmdNormalLaunch
>
> Situation:
>
> virtual protected MyObject::Member1( EventPtr pEvent ) {
> Member2( );
> }
> private MyObject::Member2( void ) {
> // operate on some members and local vars
> }
>
> ***********************************************
> Within Member2 pointer "this" has lost the value of MyObject:
> Instead it has the address of pEvent in Member1.
> ***********************************************
> => weird results.
>
> Is this typical for a certain kind of wrong compiler settings other than
> those, which cover the global variables issue (globals should be ok with
> SysAppCmdNormalLaunch shouldn't they?`)
>
>
> --
> For information on using the Palm Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/