|
Page 1 of 1
|
[ 2 posts ] |
|
| Author |
Message |
|
argonsloth
Rookie
Joined: Tue Mar 06, 2007 10:46 pm Posts: 1
|
 Recursion
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?
|
| Tue Mar 06, 2007 10:49 pm |
|
 |
|
Dick Swan
Creator
Joined: Fri Feb 09, 2007 9:21 am Posts: 613
|
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.
|
| Thu Mar 08, 2007 9:55 pm |
|
|
|
Page 1 of 1
|
[ 2 posts ] |
|
Who is online |
Users browsing this forum: No registered users and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|