Tips-and-Tricks

Version 1 (Anthony Rowe, 05/21/2007 11:47 pm)

1 1 Anthony Rowe
2 1 Anthony Rowe
== Nano-RK Tips and Tricks ==
3 1 Anthony Rowe
Many of these suggestions are generally good practice for any resource constained development.
4 1 Anthony Rowe
5 1 Anthony Rowe
'''Don't allocate large data structures in functions'''
6 1 Anthony Rowe
 * Allocating large data structures in functions puts them on the stack.  Typically your task's stack is only 128 bytes, so putting things like a network buffer on the stack will almost certainly cause a stack overflow..
7 1 Anthony Rowe
8 1 Anthony Rowe
'''Avoid Recursive Function Calls'''
9 1 Anthony Rowe
 * Recursive function calls are also heavy when it comes to stack consumption.  Try to avoid them whenever possible
10 1 Anthony Rowe
11 1 Anthony Rowe
'''Use inline'''
12 1 Anthony Rowe
  * When it seems fit, use "inline" to avoid pushing things onto the stack for small functions