SA0056: Constant out of valid range

Function

Determines literals (constants) outside the valid operator range.

Reason

The message is output in cases where a variable is compared with a constant that lies outside the value range of this variable. The comparison then returns a constant TRUE or FALSE. This indicates a programming error.

Importance

High

Samples:

PROGRAM MAIN
VAR
    nBYTE   : BYTE;
    nWORD   : WORD;
    nDWORD  : DWORD;
    nUSINT  : USINT;
    nUINT   : UINT;
    nUDINT  : UDINT;
 
    bResult : BOOL;
END_VAR
bResult := nBYTE >= 355;                            // => SA0056
bResult := nWORD > UDINT#70000;                     // => SA0056
bResult := nDWORD >= ULINT#4294967300;              // => SA0056
bResult := nUSINT > UINT#355;                       // => SA0056
bResult := nUINT >= UDINT#70000;                    // => SA0056
bResult := nUDINT > ULINT#4294967300;               // => SA0056