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,FREEMAIL_FROM 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!feeder.news-service.com!newsfeed00.sul.t-online.de!t-online.de!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Enumeration representation clause surprise. Date: Thu, 12 Jun 2008 21:52:56 +0100 Organization: Pushface Message-ID: References: <0cbb6daf-01e9-40f5-855c-4f1d45cb0096@m73g2000hsh.googlegroups.com> <87abhs6qyj.fsf@willow.rfc1149.net> <55613982-679e-419d-8656-03b549393289@w4g2000prd.googlegroups.com> <871w346k4j.fsf@willow.rfc1149.net> <4a84770f-e273-41ad-a8ef-f22a9896b544@i36g2000prf.googlegroups.com> <48502e38$0$23821$4f793bc4@news.tdc.fi> <0d642988-cb65-412d-88b2-806e1a5b0ff3@34g2000hsh.googlegroups.com> <48516de5$0$7547$9b4e6d93@newsspool1.arcor-online.net> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1213303977 917 62.49.19.209 (12 Jun 2008 20:52:57 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Thu, 12 Jun 2008 20:52:57 +0000 (UTC) Cancel-Lock: sha1:U68HfoMFeBSZVDIi1BwrVmFTx1I= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) Xref: g2news1.google.com comp.lang.ada:678 Date: 2008-06-12T21:52:56+01:00 List-Id: Mike Silva writes: > I wonder then if this is an error at all. IANALL, but if the > program makes available your specified values when queried with the > proper mechanism (in this case, unchecked conversion), then I don't > see what difference it makes how it stores the representations in > raw memory. The only reason I have ever written representation clauses is to ensure that the contents of raw memory are what some external hardware (or software, eg at the other end of a network connection) requires them to be. So I really really don't want the compiler to do anything other than what I asked for; and if it can't, to reject the representation loudly and fatally! Given OP's declarations type Enum_T is (One, Two); for Enum_T use (One => 1, Two => 2); type Record_T is record A1 : Enum_T; A2 : Enum_T; end record; for Record_T use record A1 at 0 range 0 .. 0; A2 at 1 range 0 .. 7; end record; for Record_T'Size use 2 * 8; Foo : Record_T; there's a huge difference between an unchecked conversion of the value Foo.A1 to , which might quite reasonably have the bias removed, and UC of the value Foo as a whole, which wouldn't.