Attribute const_replaced, Attribute const_non_replaced
Fügen Sie pragma {attribute 'const_replaced'} in die Deklaration einer globalen Konstante ein, wenn Sie für diese Konstante explizit die Compiler-Option Konstanten ersetzen aktivieren möchten. Dadurch steht die Konstante in der Symbolkonfiguration zur Verfügung.
Entsprechend können Sie das Pragma {attribute 'const_non_replaced'} einfügen, um die Compiler-Option Konstanten ersetzen zu deaktivieren.
Die Option Konstanten ersetzen wird für das gesamte Projekt unter Projekteinstellungen > Compiler-Optionen (Dialogfeld) vordefiniert.
{attribute 'const_replaced'}
{attribute 'const_non_replaced'}
Die Konstanten iTestCon und bTestCon sind in der Symbolkonfiguration verfügbar, da Konstanten ersetzen durch Pragmas deaktiviert ist.
VAR_GLOBAL CONSTANT
{attribute 'const_non_replaced'}
iTestCon : INT := 12;
{attribute 'const_non_replaced'}
bTestCon : BOOL := TRUE;
rTestCon : REAL := 1.5;
END_VAR
VAR_GLOBAL
iTestVar : INT := 12;
bTestVar : BOOL := TRUE;
END_VAR