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.2 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, XPRIO_SHORT_SUBJ autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,78b2880bc7e78e39 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-20 06:52:09 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!newsfeeds.belnet.be!news.belnet.be!newsfeed.icl.net!diablo.netcom.net.uk!netcom.net.uk!fr.clara.net!heighliner.fr.clara.net!grolier!newsfeed.planete.net!psinet-france!psiuk-f4!psiuk-p4!uknet!psiuk-n!news.pace.co.uk!nh.pace.co.uk!not-for-mail From: "Marin David Condic" Newsgroups: comp.lang.ada Subject: Re: RISC Date: Tue, 20 Mar 2001 09:34:27 -0500 Organization: Posted on a server owned by Pace Micro Technology plc Message-ID: <997pq4$i35$1@nh.pace.co.uk> References: <98qumf$5sf$1@nh.pace.co.uk> <98r4g1$7r1$1@nh.pace.co.uk> <3ab1d090$1@pull.gecm.com> <98t8la$rc$1@nh.pace.co.uk> <3ab72c8f$1@pull.gecm.com> NNTP-Posting-Host: 136.170.200.133 X-Trace: nh.pace.co.uk 985098884 18533 136.170.200.133 (20 Mar 2001 14:34:44 GMT) X-Complaints-To: newsmaster@pace.co.uk NNTP-Posting-Date: 20 Mar 2001 14:34:44 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.lang.ada:5897 Date: 2001-03-20T14:34:44+00:00 List-Id: "Martin Dowie" wrote in message news:3ab72c8f$1@pull.gecm.com... > I have to confess to using checked conversion - I hadn't concidered > overlays. > Do you mean unchecked conversion? That works, but it forces you to move the data twice just to satisfy language rules & may be too inefficient for some apps. Its not A Bad Thing in my estimation, but I'd rather not have to. > Thinking about it I'm not sure I could as we try and avoid having _any_ > representation clauses on any of the type that we use within the > application. > Well, that's fine for everything used internal to the system. The moment data enters/leaves the system from/to some other source, you *really* want to guarantee the representation is what is expected. How would you do this without representation clauses? > If I were to use an overlay, is it possible to use a 'Valid check on the > resulting > object and verify it that way? > You'd have to check with a language lawyer. My impression is that this is what the attribute is for. Go ahead and declare a stream of bytes for the I/O part to work. Once you get the data, you reference an overlaid record to pull the data apart. I think the 'Valid attribute should force a check of the data "assigned" to the record. (Probably works with Unchecked_Conversion as well...) Of course, you just do all this stuff backwards to handle output. > Am I right in thinking that overlays are now 'guarenteed' to work as we > lay-people > expect? I know in '83 they were 'a bad thing' although they worked in every > case I ever saw them used. I don't think overlays were ever not "guaranteed to work" in Ada83 - at least no more or less so than in Ada95. (You may have cases where the compiler or linker pukes on you. I've had this happen attempting to overlay things from different contexts.) They were/are considered to be "A Bad Thing" because of the inherent lack of safety involved. (Much like the use of gotos is frowned upon, but they are still supported.) It is recognized that overlays can provide an elegant and effective solution to a number of problems (such as this one!) if they are used carefully and judiciously. The language attempts to discourage their use because programmers will, like most normal people, abuse the privilege if left unrestrained. I think the ARM probably says something about programs relying on overlays being "erroneous" or some other carefully defined term that basically means "it may work but all bets are off from a language lawyer's perspective." This is probably because there is no good universal way of defining behavior across all hardware and compiler implementations. So go ahead and use overlays, but realize you're operating without a net. MDC -- Marin David Condic Senior Software Engineer Pace Micro Technology Americas www.pacemicro.com Enabling the digital revolution e-Mail: marin.condic@pacemicro.com Web: http://www.mcondic.com/