|Page 1 of 1|
|Author:||argonsloth [ Tue Mar 06, 2007 10:49 pm ]|
It seems that recursive calls on the NXT cause my programs to crash.
Is recursion implemented in robot C?
If not is it likely to be included in a future version?
|Author:||Dick Swan [ Thu Mar 08, 2007 9:55 pm ]|
RobotC on the NXT currently supports five levesl of subroutine calls. Next version will support 10 levels of nesting. This is limited by the size of the internal task stack.
Recursion is supported up to the previous limits. With one caveat. Procedure parameters and local variables are currently static variables. This means there is only one copy of these so that if you call a function recursively and the function has either parameters or local variables you'll get strange results. [Byt the way, use of static procedure variables is common in C compilers for small microprocessors. This method is also used in the NXC system.]
A future vesion will migrate to stack storage for procedure parameters and local variables.
|Page 1 of 1||All times are UTC - 5 hours [ DST ]|
|Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group