SA0148: Unusual bit access - strict

Function

Determines bit access operations that are not performed on bit field data types (BYTE, WORD, DWORD, LWORD).

Reason

The IEC 61131-3 standard only allows bit access to bit field data types. However, the TwinCAT 3 compiler also allows bit access to unsigned data types.

Importance

Low

SA0148: Unusual bit access - strict 1:

See also non-strict rule SA0018: Unusual bit access.

Samples:

PROGRAM MAIN
VAR
    nINT      : INT;
    nDINT     : DINT;
    nULINT    : ULINT;
    nSINT     : SINT;
    nUSINT    : USINT;
    nBYTE     : BYTE;
END_VAR
nINT.3    := TRUE;               // => SA0148
nDINT.4   := TRUE;               // => SA0148
nULINT.18 := FALSE;              // => SA0148
nSINT.2   := FALSE;              // => SA0148
nUSINT.3  := TRUE;               // => SA0148
nBYTE.5   := FALSE;              // no error because BYTE is a bitfield