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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,6339fea48a1b8cda X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!fdn.fr!club-internet.fr!feedme-small.clubint.net!newsfeed.freenet.de!npeer.de.kpn-eurorings.net!npeer-ng1.kpn.DE!nntp.ilk.net!not-for-mail From: Markus Schoepflin Newsgroups: comp.lang.ada Subject: Re: Enumeration representation clause surprise. Date: Wed, 11 Jun 2008 14:56:34 +0200 Organization: Customer of ILK Internet GmbH, Karlsruhe, Germany Message-ID: References: <0cbb6daf-01e9-40f5-855c-4f1d45cb0096@m73g2000hsh.googlegroups.com> NNTP-Posting-Host: csdc.comsoft.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: nntp.ilk.net 1213188994 12622 212.86.205.70 (11 Jun 2008 12:56:34 GMT) X-Complaints-To: usenet@ilk.net NNTP-Posting-Date: Wed, 11 Jun 2008 12:56:34 +0000 (UTC) User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) In-Reply-To: <0cbb6daf-01e9-40f5-855c-4f1d45cb0096@m73g2000hsh.googlegroups.com> Xref: g2news1.google.com comp.lang.ada:645 Date: 2008-06-11T14:56:34+02:00 List-Id: christoph.grein@eurocopter.com wrote: > What you request for A1 seems impossible: Store value 2 = 2#01# in one > bit. This is exactly my point. I would have expected a compile time error for this impossible request. Representation clauses are (amongst other) meant to specify specific binary layouts for interfacing with the external world. Or am I mistaken here? > An illustrating example: > > type My_Int is range 10_000 .. 10_001; > > type My_Record is record > I: My_Int; > end record; > > for My_Record use record > I at 0 range 0 .. 0; > end record; > > This is allowed. My_Record holds only two values, so one bit is > enough. The compiler uses a so-called biased representation with > 10_000 as bias, which need not be stored. Yes, I am aware that this feature exists, I am just unhappy that it is also allowed for enumerations. Is there another Ada mechanism for specifying external interfaces like this one? One that does not have the same subtle maintenance trap? > Hope this helps. Thanks, Markus