What is the #OPT command?
what is optimization level?
Anyone could explain this pre-proccessor command?
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
Posted: Sat Jul 19, 2008 5:31 pm
Basic answer: if you don't know what it is you don't need to change it. The default setting is good for 99% of the applications.
Advanced answer:
A compiler translates your C-code into assembly language. After the first rough 'translation' the code passed on to an Optimizer module for optimizing the memory usage and speed improvements. Often the most compact code is also the fastest code but in some situations there is a choice to be made between code size and execution speed. The numbers you specify in the #OPT pragma tell the compiler if priority should be given to execution speed or code size.
The documentation is poor and doesn't mention the exact effect of the numbers. General speaking, higher numbers result in smaller code where the current highest optimization level is 11 (I believe).
Optimization can make debugging more difficult because code lines might get 'optimized' away, prohibiting you from setting a breakpoint on these disappeared code lines. Then disable the optimizer.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum