E2028 Sets may have at most 256 elements (Delphi)

From RAD Studio
Jump to: navigation, search

Go Up to Error and Warning Messages (Delphi) Index

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.