Skip to main content

SA0122: Array index defined as expression

Detects the use of expressions in the declaration of array indexes

Justification: Not all systems permit expressions as array limits.

Importance: Low

Example 106. Example
PROGRAM PLC_PRG
VAR CONSTANT
    c_iValue : INT := INT#15;
END_VAR
VAR
    arr : ARRAY [0..c_iValue + 1] OF INT;
END_VAR

Output in the Messages view:

  • sa_icon_message.png SA0122: Only constants allowed for array definition 'arr'