Attribute ‘const_replaced’, attribute ‘const_no_replaced’ΒΆ

The effect of the pragma {attribute 'const_replaced'} is that the compiler option Replace constants is explicitly activated for all global constants containing this attribute in the constant declaration.

Accordingly, you insert the pragma {attribute 'const_non_replaced'} in order to explicitly deactivate the compiler option Replace constants. This can be desirable, for example, so that a constant is available in the symbol configuration.

The option Replace constants in the dialog box Project settings, category Compile options is preset for the entire project.

Syntax:

{attribute 'const_replaced'}

{attribute 'const_non_replaced'}

Insertion position: line above the declaration line of the global variables.

Example

The constants iTestCon and bTestCon are available in the symbol configuration, because the option Replace constants is deactivated.

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

See also