[Lazarus] Having more than 32 elements in a set (TGridOptions of TCustomGrid)
Flávio Etrusco
flavio.etrusco at gmail.com
Thu Nov 6 10:39:09 CET 2014
On Thu, Nov 6, 2014 at 3:41 AM, Sven Barth <pascaldragon at googlemail.com> wrote:
> On 06.11.2014 04:43, Flávio Etrusco wrote:
>>>
>>> Default values must be of ordinal, pointer or small set type (Delphi)
>>> (See:
>>> http://docwiki.embarcadero.com/RADStudio/XE7/en/E2146_Default_values_must_be_of_ordinal,_pointer_or_small_set_type_%28Delphi%29)
>>>
>>> After you added the 33-rd option now SizeOf(TGridOptions) = 32 bytes.
>>> Every option is stored as a bit, so you can have 256 (=32*8) options (I
>>> think).
>>
>>
>> No, SizeOf(TGridOptions) = 4 (bytes) = 32 bits = 32 options.
>
>
> If a 33rd option is added he's right:
>
> === code begin ===
>
> program tsettest;
>
> type
> TTest = (
> t1,
> t2,
> t3,
> t4,
> t5,
> t6,
> t7,
> t8,
> t9,
> t10,
> t11,
> t12,
> t13,
> t14,
> t15,
> t16,
> t17,
> t18,
> t19,
> t20,
> t21,
> t22,
> t23,
> t24,
> t25,
> t26,
> t27,
> t28,
> t29,
> t30,
> t31,
> t32,
> t33
> );
>
> TTests = set of TTest;
>
> var
> t: TTests;
> begin
> Writeln(SizeOf(t));
> end.
>
> === code end ===
>
> === output begin ===
>
> % ./tsettest
> 32
>
> === output end ===
>
> Regards,
> Sven
Oh, OK, I misread the message. He was not implying the streaming would
allow that :-$
Sorry.
-Flávio
More information about the Lazarus
mailing list