??? 01/19/12 14:43 Read: times Msg Score: -1 -1 Message Not Useful |
#185565 - Understanding the mapping important Responding to: ???'s previous message |
Erik Malund said:
if you need to "understand the efficiency" you should not use C in the first place I don't agree. Being able to understand the efficiency of the compiler and how language constructs maps to processor instructions gives you options when writing C/C++ code. For trivial things, the compiler can convert integer multiply of 2 with a shift. But think about 8051 and pointers. When you do know the limitations the 8051 chip has when using indirect addresses, you can focus on designing without pointers or at least with no more pointers than the compiler can manage to map to index registers in the processor. Code bloat is often the result of people not knowing what is cheap and what is expensive, when they write their C/C++ program. It is only by knowing the mappings performed that you can know that for one processor, recursion is basically no-cost, allowing very clean code to run efficiently. While you on the 8051 probably need to store explicit state information in a table - a manually administered stack. |