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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3172506a50961dcb X-Google-Attributes: gid103376,public From: Martti Niska Subject: Re: Record and Element Sizes Conflict Date: 1999/10/12 Message-ID: <3803381D.8CCDCC94@ssf.fi>#1/1 X-Deja-AN: 535801777 Content-Transfer-Encoding: 7bit References: <7tt3qs$5vj$1@schbbs.mot.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Trace: read2.inet.fi 939734981 212.213.197.204 (Tue, 12 Oct 1999 16:29:41 EET DST) Organization: Sonera Ltd iNET services MIME-Version: 1.0 NNTP-Posting-Date: Tue, 12 Oct 1999 16:29:41 EET DST Newsgroups: comp.lang.ada Date: 1999-10-12T00:00:00+00:00 List-Id: "Dennis Miller > I have a record whose size does not match the size of all the combined > members. The record looks like this: > > type My_Record_Type is > record > member1 : uWord_T; > member2 : enum1_T; > member3 : uWord_T; > member4 : enum2_T; > member5 : enum3_T; > member6 : uWord_T; > member7 : uWord_T; > end record; > > The uWord_T is declared as such: > type uWord_T is range 0 .. 65535; > for uWord_T'size use 16; > > All of the sizes for the enum#_T types have been set to 32. When you add up > all the members of the record, the size comes to 160. When I do > My_Record_Type'size, the size is 192. Where are the extra bits coming from? > and where are they being added? This was tested on an Ada83 compiler. > > Dennis As Ted Dennison wrote his responce, that it depends about architecture where you use it. That, I think answer you question, but I just think that have you try pragma Pack your type and that way get it size to 160? Pragma Pack minimize storage size, but could decrease speed of running application (if speed is critical). One way to tell your compiler to be smart. type My_Record_Type is record member1 : uWord_T ; ... end record ; pragma Pack(My_Record_Type) ; My_Record : My_Record_Type ; -- now size should be 160 Cheers Martti