CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

#OPT

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
radres



Joined: 12 Apr 2007
Posts: 4

View user's profile Send private message

#OPT
PostPosted: Fri Jul 18, 2008 10:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat Jul 19, 2008 5:31 pm     Reply with quote

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.
radres



Joined: 12 Apr 2007
Posts: 4

View user's profile Send private message

PostPosted: Mon Jul 21, 2008 10:06 am     Reply with quote

Thanks a lot.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group