I compiled with the latest PODS and checked the content with Palm OS Debugger
using the Treo 650 debug simulator.
The is psudocode:
UInt16 Z;
UInt16 A;
main()
{
UInt16 *B;
B = &A;
}
The problem is that B is assigned the address of Z instead of A.
This is the machine code from my actual program:
0x030e3986: 41ed f234 lea -3532(a5),a0
0x030e398a: 2d48 ffee move.l a0,-18(a6)
a0 = 0x00b5 608c
a5 = 0x00b5 6e58
a6 = 0x00e2 a536
&A = 0x00b5 608e ( a5 - 3530 )
&B = 0x00e2 a524 ( a6 - 18 )
&Z = 0x00b5 608c ( a5 - 3532 )
( the last global var is an unsigned char &0x00b5 6e56 )
The problem is that -3532 should be -3530.
Is this a problem on my part, or a compiler bug?
This happened once before with a previous program. I created a new project,
copied all of the code into it, and it still compiled with the same problem.
I then started over, compiling a few functions at a time, and that fixed it.
I'm only using PalmOS defined var types ( UInt16, UInt32, Boolean, Char ).
----- Original Message ----
From: Henk Jonas <[EMAIL PROTECTED]>
To: Palm Developer Forum <[email protected]>
Sent: Monday, January 02, 2006 2:31:01 AM
Subject: Re: variable address incorrect
[EMAIL PROTECTED] wrote:
> Here's a simple example of the problem:
>
> UInt16 A;
> main()
> {
> UInt16 *B;
> B = &A;
> }
>
> The address of B is 0x00e2a524.
> The address of A as 0x00b5604e.
> B has the value of 0x00e5604c.
>
> Why is B 0x00e5604c and not 0x00b5604e???
>
> I'm got getting any compile warnings.
>
How did you check the content of your variables? Any smart compiler
would just skip the B = &A; assingment, as B is never used...
Regards
Henk
--
-------------------------------------------------------------------------
Henk Jonas [EMAIL PROTECTED]
Palm OS ® certified developer
Please contact me, if you need an off-site contract worker.
-------------------------------------------------------------------------
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/