This is probably a C question rather than a Palm question but
I'll ask it here anyway because of the tight resource reqts of
the palm.

I have an application that is exhibiting a strange behavior.

Some strings that are displayed in a field have a couple of
extra bytes of garbage at the end.  I have been having problem
isolating the cause.

To isolate the cause, I looked at some of the last modifications
I made.  Prior to these changes, everything worked fine.  So, I
assumed it was related to a change.  One of the thing I did was
to move some code, to a function, and make a call to that function
where that code used to resided.

To see if that was the cause, I moved the code back to it's original
location.  A guess what, the problem went away.  So, it looks like I
have nested my function calls a little too deep.  

None of these three functions (calls) have local variables. 
Call3 only initializes global variables.   So, this does not 
seem like excessive use of stack memory.  But if I take code
out of call3 function and place it in call2 function everything 
works fine.

What other things use up stack space?  Does nesting of 'if's take
up stack space?  I do use quite a few 'if's and calls are made from
within 'if's and there are several levels of 'if's in this thread.

Below is the structure of the calls and 'if's.  Does this seem like
heavy stack use?  Would use of switch() instead of 'if's make any
difference? 

MyEventHandler() {
   switch() {
      case:
         if() {
            call1();
         }
      break;
   }
}

call1() {
   if() {
      call2();
   }
}

call2() {
   for() {
      if{} {
         if() {
            call3();
         }
      }
   }
}

call3() {
// initialize global variables
// if this code is moved to location of call3 above, no problem.
}       
--
-----------------------------------------------------------------
Discussion Group:        http://www.halcyon.com/ipscone/wwwboard/

Protect your constitutional rights. Your favorite one may be next!
-----------------------------------------------------------------

Reply via email to