RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2028: Sets may have at most 256 elements (Delphi)

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.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!