Why is this an issue?

From Delphi 11 onwards, digit separators _ can be used to split numeric literals into groups.

To improve readability, this rule verifies that numeric literals using separators have groups of a standard, homogeneous size.

Noncompliant code example
  const
    WrongGroupSize = 1_0000;     // Noncompliant; using groups of 4 instead of 3
    MixedGroupSize = $F_7F_FFFF; // Noncompliant; using mixed group sizes
Compliant code example
  const
    DecimalInt       = 10_000;
    HexadecimalInt2  = $7_FF_FF;
    HexadecimalInt4  = $7_FFFF;
    BinaryInt2       = %0_10_10;
    BinaryInt3       = %01_010;
    BinaryInt4       = %0_1010;
    LongDecimalFloat = 10_000.0;
    FloatWithAnySeps = 10.0_0_00_1;

Exceptions

Only the integer component of floating point numbers is checked for compliance; the fractional and exponent parts are ignored.

How to fix it

  1. Pick an appropriate, standard digit group size from the above list.
  2. Starting from the right, group the digits in the integer using _ between groups.

Resources