"Helmut A. Bender" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Am Montag, 22. M�rz 2004 11:59 schrieb Ashirus:
> > I testing out a program and one of the function uses a static pointer.
The
> > pointer variable stores all the characters by the user, and has to
maintain
> > this between function calls (the characters are then written to screen
in
> > one truncated line). At the moment I have only allocated 100 bytes for
it,
> > and haven't got round to checking the data doesn't overflow (I've just
> > started the program).
> >
> > Problem is, every time I recompile and load it into POSE, the variable's
> > data (i.e. all the characters entered) from the last compile is still
there
> > and now exceeds 100 bytes and so crashes the program as soon as I enter
a
> > new character! I don't know how POSE maintains this data, and I don't
want
> > it!
> >
> > I know I could make sure the data my static pointer is pointing to get
> > initialised to NULL, but I want to know why this happens not how to
solve
> > it.
>
> Well - you really should initialize new menory you get, because the
content is
> undefined. Undefined means that there may be anything inside - e.g. the
data
> you wrote there the last time.

I know, as I said I just haven't got round to doing that. I want to know
what causes this behaviour, not how to solve it.

> The memory you free isn't cleared either and
> so it may happen that you get the same chunk you used last time.
>
> --
> Mit freundlichen Gr��en
> Helmut A. Bender
> Helmut Bender GmbH
>

Yes, but I get the same data *every* time I run it! Not just once or twice

--
yours,
Ash.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to