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.1 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLYTO_END_DIGIT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d9523383d7eb42d0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-22 10:45:20 PST From: Patrick Hohmeyer Subject: Re: Confused about Attribute Size? Newsgroups: comp.lang.ada Reply-To: pi3_1415926536@yahoo.ca References: User-Agent: KNode/0.6.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit Message-ID: Date: Tue, 22 Jan 2002 14:08:41 -0500 NNTP-Posting-Host: 65.94.189.86 X-Complaints-To: abuse@sympatico.ca X-Trace: news20.bellglobal.com 1011724908 65.94.189.86 (Tue, 22 Jan 2002 13:41:48 EST) NNTP-Posting-Date: Tue, 22 Jan 2002 13:41:48 EST Organization: Bell Sympatico Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!torn!webster!nf1.bellglobal.com!nf2.bellglobal.com!news20.bellglobal.com.POSTED!not-for-mail Xref: archiver1.google.com comp.lang.ada:19193 Date: 2002-01-22T14:08:41-05:00 List-Id: And Zebylon has spoken : > Hi, > > I'm a newbie in Ada but I saw an Ada example that confused me a bit, here > it is: > > type My_Type is > (startbit, > endbit, > timeout, > spare, > nextbit, > ...... > ...... > lastbit); > > for My_Type use > (startbit =>0, > endbit=>1, > timeout=>2, > spare=>3, > nextbit=>4, > ...... > ...... > lastbit=>15); > > for My_Type'Size use 8; > > type My_Type_Array is array (My_Type) of Boolean; > > What I don't understand is how you can assign the size to 8 bits? How will > this work when > there are 16 bits in the type? What will be the size of the array? > This example was in Ada 83 could this be a clue? > > Thanks > > /S Hint : My_Type is an enumeration type. Ex : Character is also an enumeration, there are 256 possible characters, does this make a character 256 bit ? ;-) The array will be 16 or 2 bytes (if you use the pragma pack, what I suspect) One boolean per possible value of My_Type. Hint2 : try some general tutorials befor trying to understand chapter 13. -- Patrick Hohmeyer