??? 11/10/11 15:24 Read: times |
#184615 - auto variables Responding to: ???'s previous message |
Lukas Valecky said:
Per Westermark said:
I think that the Keil C51 compiler/linker has some special handling for small initialized variables. What does it mean for me? It is the logic that reuses global variable space for parameters and auto variables that has optimizations depending on if the auto variable is small or large. With global variables, the initialization comes directly by the runtime library, so no need for any optimization. All initialized data (independent of size) are just placed in consecutive memory positions, allowing the initialized values to be copied (after potentially being decompressed). But local variables with initial values needs to be initialized on every visit to the function. Consider if these variables really need to get new values on every call to the function or not. |