??? 03/16/09 09:29 Read: times |
#163481 - Difference between normal auto and static auto. Responding to: ???'s previous message |
But there is one important difference.
While Keil C51 (and other 8051 compilers) don't like to place auto variables on the miniature stack, it will do a call-tree analysis to figure out what functions that will never call each other, so that the same global memory space may be used to "simulate" multiple auto variables. So from the point of the application, it should not be visible that the auto variables have been stored globally instead of on the stack as long as the application don't try to analyze the address of the variable. In short, a local variable without the "static" keyword may be converted into a global nameless variable by some copilers (such as the C51 compiler). But it will not be guarateed to keep it's value between multiple calls. A local variable with the "static" keyword will always be unique for that specific function and will keep the value between multiple calls (unless memory overwrites in buggy code). |
Topic | Author | Date |
Can ISR functions be made 'static'? | 01/01/70 00:00 | |
What does 'static' mean? | 01/01/70 00:00 | |
Nothing magic with "static" | 01/01/70 00:00 | |
'static' local variables | 01/01/70 00:00 | |
Difference between normal auto and static auto.![]() | 01/01/70 00:00 |