[fpc-devel] Sets > 256
Marco van de Voort
marcov at stack.nl
Thu Oct 15 16:26:32 CEST 2015
In our previous episode, Michael Van Canneyt said:
> >> same format.
> >>
> >
> > Yes, this would be a problem. But wouldn't this be an acceptable price for
> > the improvement?
>
> No, it is not that simple. Lazarus would stop working completely.
Sets have a size that is a function of the number of elements. (delphi mode
per byte, fpc mode per 32-bit). I don't see how raising the max number of
elements would affect Lazarus. F(nr of elements) would still give the same
allocation size.
(it does matter that sets are allocated always from element 0 though)
There already is a lot of variation just run the below program for mode
delphi and objfpc
{$mode objfpc}
type txxx = set of 50..60;
var x : txxx;
begin
writeln(sizeof(x));
end.
mode delphi prints "2", objfpc prints "32"
I always considered the 256 extremely annoying since it makes sets and enums
not very scalable. Raising the limit would also make bitindexing with larger
numbers easier.
More information about the fpc-devel
mailing list