<html><body><div class="gmail_quote">
    <div dir="ltr" class="gmail_attr">On Jan 11, 2025 at 10:53:36 PM, Sven Barth via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> wrote:<br></div>
    <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" type="cite">
        Set are a minimum of 4 Byte by default cause that's how Delphi does them. Ifets you want smaller sets then use the $PackSets directive as Martin had written. <br></blockquote><div class="gmail_quote"><br></div><div class="gmail_quote" dir="ltr">I did not know this existed. I don’t see any reason they force the set to 4 bytes unless it was being used to pass to C libraries maybe?</div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" type="cite"><br>The maximum is also based on what TP and Delphi allow. ISO Pascal for example suggests a maximum of 1024 elements instead, though they define this number to be implementation specific.<br>In the end it's a decision of where to do the cut as at some size the majority of the set will be sparsely populated so it makes more sense to use a dedicated type instead (e.g. a hash set or something like that) that wastes less memory. <br>
    </blockquote>
</div>
<div><br></div>Theoretically if you added one more element to 257 the size would double to 64 bytes right? That’s still only 50% of a short string both of which can be sparsely populate so how are they different?<div><br><div dir="ltr"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Regards,</div>    Ryan Joseph</div></div><br>
</div>
    
</div></body></html>