gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Size of SET type


From: Gaius Mulley
Subject: Re: Size of SET type
Date: Sun, 26 Mar 2023 21:16:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

TELEMAQUE Olivier <olivier.telemaque@alstomgroup.com> writes:

> Hi,
>
>  
>
> I have the code below :
>
>  
>
> MODULE My_Module;
>
>  
>
> FROM SYSTEM IMPORT SIZE;
>
> FROM libc IMPORT printf;
>
>  
>
> TYPE Byte_T = SET OF [0..7];
>
> BEGIN
>
>     printf("SIZE Byte_T = %u\n", SIZE(Byte_T));
>
> END My_Module.
>
>  
>
> I expected to have SIZE Byte_T = 1 but unfortunately SIZE Byte_T = 4. Is it 
> the behavior expected from Gm2 or is it a bug ?
>
>  
>
> Regards,
>
> Olivier

Hi Olivier,

here is a further example using the <* bytealignment(0) *> attribute
(for non SET types):

MODULE setsize ;

FROM SYSTEM IMPORT SIZE;
FROM libc IMPORT printf;

TYPE
    Byte_T = SET OF [0..7];
    Small_Set_T = PACKEDSET OF [0..7] ;
    foo = [0..7] ;
    Small_Set_T2 = SET OF foo ;
    bar = ARRAY [0..7] OF BOOLEAN <* bytealignment(0) *> ;
BEGIN
   printf("SIZE Byte_T = %u\n", SIZE(Byte_T));
   printf("SIZE Small_Set_T = %u\n", SIZE(Small_Set_T));
   printf("SIZE Small_Set_T2 = %u\n", SIZE(Small_Set_T2));
   printf("SIZE bar = %u\n", SIZE(bar));
END setsize.


regards,
Gaius



reply via email to

[Prev in Thread] Current Thread [Next in Thread]