??? 12/30/04 12:13 Read: times |
#84104 - Answer is Wrong!! Responding to: ???'s previous message |
Kiran V. Sutar said:
Some compilers generate the local variables (defined within the function) onto the stack. As Peter has already said, this is not true of Keil C51, and I doubt that any 'C' compiler that did it for the 8051 would be of any use at all. Hence any activity, you do with this variable, the compiler always reads this variable from the stack, performs the action and then stores it back on Stack; hence it takes a long time. This is not true either. The stack is just memory like any other. In situations where I need to define a lot of variables, I generally define a global Buffer of 16 bytes. This buffer is used as scratch pad in many routines. This helps me reducing the number of global variables and makes my code run faster.
This is completely wrong, and a maintenance nightmare! On an 8051, a decent compiler will Overlay local variables. It is, therefore, far better to use local variables in 8051 'C' wherever possible - there is no speed penalty, it will use less RAM, and you will not have the error-prone maintenance nightmate of shared scratchpads!! There are other ways to test if the variable is generated in stack or internal RAM. The Linker's map file is the place to look. |
Topic | Author | Date |
C Code t o Assembly | 01/01/70 00:00 | |
C to Asm | 01/01/70 00:00 | |
C Code t o Assembly | 01/01/70 00:00 | |
only one table | 01/01/70 00:00 | |
Need some more details | 01/01/70 00:00 | |
Not even true ! | 01/01/70 00:00 | |
Answer is Wrong!! | 01/01/70 00:00 | |
Re : previous 3 replies and Paul | 01/01/70 00:00 | |
Previously on 8052.com | 01/01/70 00:00 | |
Overflow | 01/01/70 00:00 | |
just one array | 01/01/70 00:00 | |
too limited, Paul | 01/01/70 00:00 | |
Nothing to do with scope | 01/01/70 00:00 | |
Agreed | 01/01/70 00:00 | |
No success ! | 01/01/70 00:00 | |
Re: Peter | 01/01/70 00:00 | |
to assembly | 01/01/70 00:00 | |
Example code | 01/01/70 00:00 | |
Any unused functions in your program? | 01/01/70 00:00 | |
query | 01/01/70 00:00 | |
Off-Topic - start a new thread | 01/01/70 00:00 | |
... and use a _descriptive_ subject!![]() | 01/01/70 00:00 |