Daniel Gaspary wrote:
On Mon, Mar 11, 2013 at 7:09 AM, Mark Morgan Lloyd
<markmll.fpc-pas...@telemetry.co.uk> wrote:
That was pretty much my gist. Since these days Unicode is larger than 65536
codepoints I don't think there's any advantage to expanding sets from 256 to
65536 elements, efficient operations on sparse arrays of 256-element sets
would be far better.

In my case the enum has near 600 elements.

TMyEnum = (me1, me2...);

The set though would never be used to contain more than 256.

TMySet = set of TMyEnum;

Is it not viable to modify the compiler to compile the code and raise
an exception if I try to add more than 256 elements to the set ?

No, because the elements in a set are dictated by their position. A set that can contain anything between 0 and 256 elements occupies 8 bytes in memory with the (bit representing the) 0 element at one end and the (bit representing the) 256 element at the other, a set to contain up to (say) 257 elements would require more space and that's not supported.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to