Skip to main content

Compiler Error C0454

Message: It is not possible to use an assignment expression with the __NEW operator in another expression. Use the pointer variable instead.

Possible error cause: An assignment with the __NEW operator is used directly in a test against 0.

Error correction: Use the assignment as a standalone statement. Use the POINTER variable in the condition of the IF statement.

Example 486. Example of the error:
PROGRAM PLC_PRG
VAR
      pSt: POINTER TO ST_Data;
END_VAR

IF (pSt := __NEW(ST_Data)) = 0 THEN
      RETURN;
END_IF

Message:

C0454: It is not possible to use an assignment expression with the __NEW operator in another expression. Use the pointer variable instead.



Example 487. Example of an error correction:
PROGRAM PLC_PRGVAR
      pSt: POINTER TO ST_Data;
END_VAR

pSt := __NEW(ST_Data);
IF pSt = 0 THEN
      RETURN;
END_IF