-OnCstVar: Disable CONST Variable by Constant Replacement

Group

OPTIMIZATIONS

Scope

Compilation Unit

Syntax
  -OnCstVar
  
  
Arguments

None

Default

None

Defines

None

Pragmas

None

Description

This option allows you to switch OFF the replacement of CONST variable by the constant value.

Example
  const int MyConst = 5;

  
  int i;

  
  void myfun(void) {

  
    i = MyConst;

  
  }

  

Without the -OnStVar option, the compiler replaces each occurrence of MyConst with its constant value 5; that is, i = MyConst becomes i = 5;. The Compiler optimizes the Memory or ROM needed for the MyConst constant variable as well. Setting the -OnCstVar option avoids this optimization. Use this option only if you want unoptimized code.