> > -----Original Message-----
> > From: McMicken, Steven [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, March 09, 2000 8:47 AM
> > To: Palm Developer Forum
> > Cc: '[EMAIL PROTECTED]'
> > Subject: RE: help with MemHandleNew
> >
> >
> > Have you allocated memory to charRatio? If you don't assign
> > memory to it
> > with MemPtrNew, the memory that it points to can change
> > without notice,
> > since your program hasn't reserved it from the system.
>
>Not to mention the debugger on Codewarrior 5 and 6 sometimes do funny things
>to local variables if you're stepping through the code watching the string.
>I have seen the damned strangest stuff happen to local variables while
>debugging.
Actually, what is happening is quite simple.
The compiler has noticed that two variables have disjoint lifetimes,
and has assigned them the same address. The debugger shows them as
two variables, but they share the same storage. When one changes,
the other one will too.
Here's an example:
void foo ( void ) {
short i, j;
for ( i = 0; i < 10; i++ )
bar ();
for ( j = 0; j< 10; j++ )
bar ();
}
The compiler may put i and j into the same space on the stack.
As you step through the loop(s), you will see that i and j always
contain the same value.
-- Marshall
"The era of big government is over."
Bill Clinton, State of the Union Address, January 23, 1996
Marshall Clow Adobe Systems <mailto:[EMAIL PROTECTED]>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html