P4096¶
- Code
P4096
- Message
Hex/binary/octal literal as a subrange or array bound requires choosing a dialect or –allow-radix-subrange-bounds flag
This error occurs when a bound of a subrange type or of an array dimension
is a hex, binary, or octal literal (e.g. 16#FF, 2#1010, 8#17)
without the --allow-radix-subrange-bounds compiler flag.
The IEC 61131-3 standard grammar (Annex B) defines
subrange ::= signed_integer '..' signed_integer, where signed_integer
is a decimal digit sequence, so a radix bound is an extension. A bound of a
CASE subrange label is gated by its own flag and reported as
P4041.
A decimal bound (0..255) is standard syntax and is always allowed.
Example¶
The following code will generate error P4096:
TYPE
BYTE_RANGE : INT (16#00..16#FF);
END_TYPE
To fix this error, either write the bounds in decimal:
TYPE
BYTE_RANGE : INT (0..255);
END_TYPE
Or enable the extension:
Pass the --allow-radix-subrange-bounds flag to enable it, or select a dialect that includes it. See
Enabling Dialects and Features for the dialects and flags
reference.
Think IronPLC is wrong about this?
If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.