4 ms·
https://news.ycombinator.com/item?id=4339999 https://news.ycombinator.com/item?id=4339999
by valevk 12y ago
https://news.ycombinator.com/item?id=4339999 https://news.ycombinator.com/item?id=4339999
- vans 12y agoWOW ! << Do not use direct or indirect recursion. Do not use dynamic memory allocation after task initialization. >> I think they should use COBOL, it's built in :)
- Jtsummers 12y agoThose are standard restrictions for embedded real-time systems, especially if the language itself doesn't offer guarantees on tail-call optimization (like the ML family, Erlang and others do). You have to guarantee the behavior of the program, and recursion (especially unbounded memory usage as in many C implementations) can royally screw things up. You may still have infinite loops because of an error in a for loop's terminating condition, but without dynamic memory and exploding stack usage you'll at least have enough memory left to deal with it when the watchdog timer kicks in.