Are you calling getDxByIndex within getDxByIndex? If you are, that may be
considered recursion, and I believe it is not allowed in the Palm OS. If
you are calling the same function name from another class, that should be
ok. If that is not the problem, the only other suggestion is to make sure
other variables are not overwriting your call on the stack (make sure you
are using pointers correctly & within their allocated memory space).
-----Original Message-----
From: Samir Raiyani <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Thursday, July 29, 1999 3:57 AM
Subject: parameter passing errors in debugger
>
>A friend writes to me:
>
>Hello,
>
>I am new at developing applications for the Palm using Metroworks
>Codewarrior. I am encountering some very strange errors while using the
>Debugger that I need to fix or work around.
>
>Essentially, passing parameters that are only used in simple
>integer-to-integer assignment statements does not work correctly. I am
>getting values like 65,000 or 13,000 instead of the 1 or 2 that I passed
>into the function.
>
>I believe that Metroworks compiler optimizations sometimes have this
>effect. It may also be an error in my code relating to the stack.
>
>I have used Metroworks Codewarrior and Metroworks Powerplant on the Mac to
>develop C and C++ applications in the past. I have encountered errors
>in the past where variables that are no longer considered to be in use are
>filled with junk values.
>
>If anyone has any suggestions on how to fix this problem, please e-mail
>me. Thanks.
>
>Chester
>
>
>sample code:
>
>1)
>
>inside a function by the name of
>
> Dx *DxList::getDxByIndex(int index)
>
>this call (initially: index = 1)....
>
> if (D[index]==NULL)
> D[index]=dxListDB->getDxByIndex( index );
>
>....results in this problem (initially: idx = -65536, i=1)
>
> Dx *
> CDxListDB::getDxByIndex(int idx)
> {
> int i, size = getSize();
>
> if (idx>=getSize() || idx<0) {
> return NULL;
> }
>
> (after stepping over getSize(), size=2, i & idx are the same)
>
>2)
>
>this call (initially: size = 2)....
>
> setSize(size);
>
>....results in this problem (initially: input=2, listSize=0)
>
> void
> List::setSize(int input)
> {
> listSize = input;
> }
>
> (after stepping over the assignment statement, input=2, listSize=131072)
>
>
>
>