[fpc-devel] Sets > 256
Jonas Maebe
jonas.maebe at elis.ugent.be
Thu Oct 15 16:21:53 CEST 2015
DaWorm wrote on Thu, 15 Oct 2015:
> What if someone is storing a set in a file, or a stream? Old version saves
> it, new version reads it, and all of the sudden the data isn't in the same
> format.
Support for larger sets would not change the format of smaller sets.
The amount of space a set takes up depends on the element type of the
set and the {$packset x} setting. Neither of these would automatically
change for existing sets.
That said, sets for 256 elements already take up 32 bytes. Larger sets
will usually be quite sparse, which means that just increasing the
size will end up wasting a lot of memory. It would probably be better
to use a dedicated bitmap class (generic or not) instead that is more
clever than just using a bit array (although you could still do that
in the class, using a bitpacked array of boolean).
Jonas
More information about the fpc-devel
mailing list