HomeDelphiDelphi Error – E2028 Sets may have at most 256 elements

Delphi Error – E2028 Sets may have at most 256 elements

Delphi Compiler Error

E2028 Sets may have at most 256 elements

Reason for the Error & Solution

This error message appears when you try to declare a set type of more than 256 elements. More precisely, the ordinal values of the upper and lower bounds of the base type must be within the range 0..255.

program Produce;
type
  BigSet = set of 1..256;  (*<-- error message given here*)
begin
end.

In the example, BigSet really only has 256 elements, but is still illegal.

program Solve;
type
  BigSet = set of 0..255;
begin
end.

We need to make sure the upper and lower bounds and in the range 0..255.

Share:

Leave a Reply

You May Also Like

Delphi Compiler Error X2421 Imported identifier ‘%s’ conflicts with ‘%s’ in ‘%s’ Reason for the Error & Solution This occurs...
Delphi Compiler Error X2367 Case of property accessor method %s.%s should be %s.%s Reason for the Error & Solution No...
Delphi Compiler Error X2269 Overriding virtual method ‘%s.%s’ has lower visibility (%s) than base class ‘%s’ (%s) Reason for the...