Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

E0033: an ARRAY[*] where Ed.3 does not allow one

ARRAY[*] is an array whose bounds are the caller’s (Ed.3 6.5.3). It is a parameter only:

  • an input, output or in-out of a FUNCTION or a method;
  • an in-out of a FUNCTION_BLOCK.

Every dimension of it is *: ARRAY[*, *] OF INT, not ARRAY[*, 1..3] OF INT. A variable, a structure’s field, a global or a TYPE has bounds of its own.

FUNCTION SUM : DINT
    VAR_IN_OUT a : ARRAY[*] OF INT; END_VAR       (* fine *)
    VAR i : DINT; END_VAR
    FOR i := LOWER_BOUND(a, 1) TO UPPER_BOUND(a, 1) DO
        SUM := SUM + a[i];
    END_FOR;
END_FUNCTION

PROGRAM main
    VAR x : ARRAY[*] OF INT; END_VAR              (* E0033 *)
END_PROGRAM

An array of fixed bounds is given to an ARRAY[*] of as many dimensions and the same element type; an ARRAY[*] is not given to one of fixed bounds, whose size it may not have.