From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FROM_STARTS_WITH_NUMS,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,29a495fc15820386,start X-Google-Attributes: gid103376,public From: 100331.2264@compuserve.com (R.J. Kirkbride) Subject: Help with alignment of record types (GNAT) Date: 1996/04/29 Message-ID: <4m31pu$9br@dub-news-svc-5.compuserve.com>#1/1 X-Deja-AN: 152079120 organization: CompuServe Incorporated newsgroups: comp.lang.ada Date: 1996-04-29T00:00:00+00:00 List-Id: I have been defining the following structure in GNAT (3.01) under Linux: max_size : constant := 10; subtype relative_index is natural range 0 .. max_size; type text (maximum_length : relative_index) is record length : relative_index := 0; value : string (1 .. maximum_length; end record; By my calculations this structure should take 4 + 4 + 10 bytes = 18 bytes. However, despite efforts with alignment clauses and representation clauses on 'text', I cannot stop it making the structure 20 bytes in size. This is I assume so that is can make it a whole number of 32 bit words. (It works as expected with 'max_size' set to 12) I thought a pragma pack would do it - but no so much luck. I cannot just do a "for text'size use 144" because the size should vary at run time if I declare "new text"s with different sizes. Any help would be most appreciated, Rob