Skip to main content

SA0060: Zero used as invalid operand

Detects operations where an operand with the value 0 causes an invalid or a nonsense operation

Justification: This kind of expression could be an indication of a programming error. In any case, it unnecessarily wastes runtime.

Importance: Medium

Example 71. Example
PROGRAM PLC_PRG
VAR
    byTemp1 : BYTE;
    wTemp2 : WORD;
    dwTemp3 : DWORD;
END_VAR
byTemp1 := byTemp1 + 0;
wTemp2 := wTemp2 - WORD#0;
dwTemp3 := dwTemp3 * DWORD#0;

Output in the Messages view:

  • sa_icon_message.png SA0060: Zero used as invalid operand