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

Your email address will not be published. Required fields are marked *

You May Also Like

Delphi Compiler Error E2313 Attribute – Known attribute cannot specify properties Reason for the Error & Solution No further information...
Delphi Compiler Error E2379 Virtual methods not allowed in record types Reason for the Error & Solution No further information...
Rodrigo , one of the long time Delphi Developer has been working on one of his personal project “Delphi IDE...