To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 5444
5443  |  5445
Subject: 
Re: Stack Overflow
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Thu, 11 Feb 1999 02:23:39 GMT
Original-From: 
William Sitch <wsitch@engsoc.carleton#IHateSpam#.ca>
Viewed: 
927 times
  
Hi everyone:

    Sorry for the reply latency, I was buried under an avalanche of work and
assignments.  Changing the format of the code (as detailed below) helped
immensely.  I re-wrote two of my drivers to use the increased size, and
everything is working perfectly.

I believe this is definitely something for the FAQ, as the solution is
fairly obscure, and the "yacc" keyword is best searched for.  Thanks to Max,
Regan, and Fred, for all your kind help.

----- Original Message -----
From: Max Davies <mdavies@CAM.ORG>
To: William Sitch <wsitch@engsoc.carleton.ca>
Cc: <handyboard@media.mit.edu>
Sent: Sunday, January 24, 1999 11:16 AM
Subject: Re: Stack Overflow


William Sitch wrote:

...I tried to increase the stack size of the process I spawn, but the • error
still exists.  I think I might be getting a compile-time stack overflow - • or
something like that.  The procedure it crashes for is a leg controller, • and
consists of many "if .. else if" statements.

If your code looks something like this...

if (i == 1) do001(); else
if (i == 2) do002(); else
if (i == 3) do003(); else
.
.
.
if (i == 100) do100();

...then try changing it to this:

/* Not really a loop, just so we can break */

for (;;) {
   if (i == 1) {
       do001();
       break;
   }
   if (i == 2) {
       do002();
       break;
   }
   if (i == 3) {
       do003();
       break;
   }
   .
   .
   .
   if (i == 100) {
       do100();
       break;
   }

   break;  /* Always break... this isn't really a loop */
}


...this won't be any less efficient and should resolve your compile-time • stack
overflow as it doesn't nest the IF statements.

/Max





1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR