[fpc-pascal] Set limitations
Martin Frb
lazarus at mfriebe.de
Sat Jan 11 15:20:49 CET 2025
On 11/01/2025 14:57, Hairy Pixels via fpc-pascal wrote:
> On Jan 11, 2025 at 8:17:33 PM, Hairy Pixels <genericptr at gmail.com> wrote:
>> I was curious, is there any practical limit on the size of a set (32
>> bits and 256 values) and why they couldn’t be 64 bit or any other
>> arbitrary size? The floor seems to be 4 bytes too but why not allow
>> smaller sizes to save memory? Perhaps just a historical artifact but
>> I was curious.
>
> Sorry that was wrong, the biggest size is 32 bytes and the largest
> size of an enum is 256 elements. I was talking about sets of enums
> also if that wasn’t clear.
>
> I still don’t see it’s possible to make a set which is smaller than 4
> bytes, even in the 0..7 range.
>
program Project1;
{$PackSet 1}
var
a: set of byte;
b: set of 0..7;
begin
writeln(sizeof(a));
writeln(sizeof(b));
readln;
end.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20250111/9b5a68ee/attachment.htm>
More information about the fpc-pascal
mailing list