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,MAILING_LIST_MULTI, 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 00:02:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!isdnet!enst!enst.fr!not-for-mail From: Christoph Grein Newsgroups: comp.lang.ada Subject: Re: Confused about Attribute Size? Date: Tue, 22 Jan 2002 09:00:43 +0100 (MET) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1011686522 48832 137.194.161.2 (22 Jan 2002 08:02:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 22 Jan 2002 08:02:02 +0000 (UTC) Return-Path: Content-MD5: f9PKS9o5OrK23SoLmYCZOg== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk X-Reply-To: Christoph Grein List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:19167 Date: 2002-01-22T09:00:43+01:00 > > type My_Type is > (startbit, > endbit, > timeout, > spare, > nextbit, > ...... > ...... > lastbit); This assigns _values_ (not bit positions) to the enumeration literals that shall be used to represent them internally, i.e. startbit has the value (or is another name for) 0, lastbit the value 15. However you have no access to the internal values (you can't add them e.g. startbit + timeout is illegal). > for My_Type use > (startbit =>0, > endbit=>1, > timeout=>2, > spare=>3, > nextbit=>4, > ...... > ...... > lastbit=>15); > > for My_Type'Size use 8; Since a value of 15 = 2#00001111# can be represented in 8 bits, there is no problem. > 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? In Ada95, there is no need to explicitly define this default representation, see RM 13.4(8).