??? 06/02/09 06:07 Read: times |
#165725 - Software loops can be optimized away Responding to: ???'s previous message |
The delay function does not change any global variable.
And it does not return a computed result based on your input parameters or any global variables. A good compiler may notice that your sdelay function does not actually "produce" any work, so the function may be optimized away. Have a look on this forum for discussions about software loops. For short loops, you should consider assembler. For longer loops, you should consider using a hardware timer (polling or with interrupt). |