[Icc-avr] Variables declared in main() and the stack

Richard richard-lists at imagecraft.com
Thu Nov 29 16:16:12 PST 2007


At 01:26 PM 11/29/2007, Albert vanVeen wrote:
>How do you solve Fibernacci without recursion?

For every recursive function, you can have an iterative one...

>But Kevin set me wondering about vars 'local' in main(), usually only
>used for initial setups; will they then remain on the stack, forever
>unused? As I've never run out of memeory, I've never worried about these
>things.

ICCAVR is smart and in most cases will allocate variables to 
registers. It will not save/restore those registers because main() is 
implicitly a "C Task." All this means is that in most case you don't 
have to worry.


// richard (This email is for mailing lists. To reach me directly, 
please use richard at imagecraft.com) 



More information about the Icc-avr mailing list