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 Path: g2news1.google.com!news1.google.com!news.glorb.com!peer1.news.newnet.co.uk!194.159.246.34.MISMATCH!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: Fri, 13 Jun 2008 06:49:09 +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> <0120c799-fd71-41dc-bad1-c5e4f71c87f4@34g2000hsh.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.demon.co.uk 1213336149 7119 62.49.19.209 (13 Jun 2008 05:49:09 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Fri, 13 Jun 2008 05:49:09 +0000 (UTC) Cancel-Lock: sha1:yRZ+OaLQ/YaHGIZ+EJjeKBNWiVM= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) Xref: g2news1.google.com comp.lang.ada:684 Date: 2008-06-13T06:49:09+01:00 List-Id: Mike Silva writes: > On Jun 12, 4:52�pm, Simon Wright wrote: >> 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. > > OK, I understand that - so how would you pass this raw memory to the > external hardware or software? Obtain the address to which the hardware registers are mapped (talking VME here) & convert to a pointer to a structure which describes how the hardware expects to see memory, then write through that pointer. Or, for example, function To_Stream_Element here: http://coldframe.cvs.sourceforge.net/coldframe/adasntp/SNTP.impl/sntp_support.adb?revision=1.4&view=markup where I'm packing an unrepresented Status into a single byte for transmission. Nowadays I might do this using shift-and-mask to avoid messing with endianness (this code has to work with Ada 95, even if the new 05 features would help). > And in this case, how did the use of > biased representations ever get into compilers at all? Is there any > possible use of biased representations that does not fail the > requirement you have established? If I don't care how the compiler wedges the data into the record so long as it's as small as possible (pragma Pack) then a biased rep would be quite reasonable.