Skip to main content

Compiler Warning C0564

Message: A reference to uninitialized variable <variable1> is used for initialization of <variable2>. Accessing the uninitialized variable may result in unexpected behavior.

Possible error cause: A reference to an uninitialized variable is used to initialize another variable.

Error correction: Declare<variable1>before variable<variable2>.

Example 497. Example of the warning
PROGRAM PLC_PRG
VAR
      inst : FB := STRUCT(ii := inst2);
      inst2 : FBI;
END_VAR

The initialization of the variable inst produces the following warning when it is declared.

Message:

C0564: A reference to uninitialized variable inst2 is used for initialization of inst. Accessing the uninitialized variable may result in unexpected behavior.

Error correction: Declare the variable inst2 before the variable inst.

PROGRAM PLC_PRG
VAR
      inst2 : FBI;
      inst : FB := STRUCT(ii := inst2);
END_VAR