__optlevel

Optimization level exported as a predefined macro.

Syntax
__optlevel0
  
__optlevel1
  
__optlevel2
  
__optlevel3
  
__optlevel4
  
Remarks

Using these macros, user can conditionally compile code for a particular optimization level. The following table lists the level of optimization provided by the __optlevelx macro.

Table 1. Optimization Levels
Macro Optimization Level
__optlevel0 O0
__optlevel1 O1
__optlevel2 O2
__optlevel3 O3
__optlevel4 O4
Example

The listing below shows an example of __optlevelx macro usage.

Listing 1. Example usage of __optlevel macro
int main() 
{ 
#if __optlevel0 
... // This code compiles only if this code compiled with Optimization 
level 0 
#elif __optlevel1 
... // This code compiles only if this code compiled with Optimization 
level 1 
#elif __optlevel2 
... // This code compiles only if this code compiled with Optimization 
level 2 
#elif __optlevel3 
... // This code compiles only if this code compiled with Optimization 
level 3 
#elif __optlevel4 
... // This code compiles only if this code compiled with Optimization 
level 4 
#endif 
} 
Related information
__ASSEMBLER__
__COMPILER__
__COUNTER__
__TARGETARCH__
__VERSION_NUM__
__VERSION__
__cplusplus
__CWBUILD__
__CWCC__
__DATE__
__embedded_cplusplus
__FILE__
__func__
__FUNCTION__
__ide_target()
__LINE__
__MWERKS__
__PRETTY_FUNCTION__
__profile__
__STDC__
__TIME__