comp.lang.ada
 help / color / mirror / Atom feed
From: cis.ohio-state.edu!magnus.acs.ohio-state.edu!csn!news.den.mmc.com!iplmail !alcyone!rgilbert@ucbvax.Berkeley.EDU  (Bob Gilbert)
Subject: Re: Data Overlays
Date: 18 Aug 93 12:55:40 GMT	[thread overview]
Message-ID: <1993Aug18.125540.1393@iplmail.orl.mmc.com> (raw)

In article C64@irvine.com, adam@irvine.com (Adam Beneschan) writes:
>In article <1993Aug17.202435.20364@iplmail.orl.mmc.com> rgilbert@orl.mmc.com 
>(Bob Gilbert) writes:
>
>>   The problem I have with using Unchecked_Conversion is that I beleive that
>>   it produces an additional copy of the data. . . .
>
>Only if you're using an inferior compiler.  A good compiler should
>recognize Unchecked_Conversion and use it to treat the data at
>whatever address as an object of whatever type.  It shouldn't generate
>a copy or any other code.
>
>Check the code your compiler is producing.  If it's generating code to
>copy the object, call your compiler vendor and bawl them out for
>stupidity.  :-)  (Don't mind me, I'm in an intolerant mood today.)
>
>                                -- Adam
>
>--
>The above opinions are my own and do not necessarily reflect the
>opinions of Irvine Compiler Corporation.
>
>

Well OK, the Unchecked_Conversion function by itself does not produce a
copy of the data, but the return parameter is either being assigned to some
other object (copy) or it can only be used for a comparison for some decision.
Also the return parameter is going to be the entire object, not just the
element of the object that is of interest.  Unchecked_Conversion provides
read-only access, I can't write to the same object using different types.
For the purpose of producing a true data overlay, I don't see how using
Unchecked_Conversion is going to accomplish this.

As far as the technique of:

       X : TYPE_1;
       Y : TYPE_2;
       for Y use at X'address;

The LRM 13.5 states that address clauses should not be used to achieve overlays
of objects...  Any program using address clauses to achieve such effects is
erroneous.  What is the rationale for this?

Now I understand that there could be potential problems using the above 
technique because of various optimization and code generation methods used by
the compiler that could result in a delayed store (value assigned still held
in a register and not accually written to memory).  Also I could envision
problems when using processors which make use of cache.  But there should
be some method (pragma) to insure that an assignment truely affects the
mapped memory location.  Heck, the compiler is smart enough to caution me
about using the above method, I think it could take the precautions necessary
to make this safe.

Still looking for a proper method to produce a data overlay.

                             Bob

             reply	other threads:[~1993-08-18 12:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-08-18 12:55 cis.ohio-state.edu!magnus.acs.ohio-state.edu!csn!news.den.mmc.com!iplmail [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-01 14:36 Data Overlays David Emery
1993-09-01  4:23 Jim Lonjers
1993-08-31 20:36 dog.ee.lbl.gov!agate!howland.reston.ans.net!math.ohio-state.edu!magnus.ac
1993-08-31  3:51 Jim Lonjers
1993-08-23 14:17 Bob Crispen
1993-08-23 14:11 Alex Blakemore
1993-08-19 13:16 cs.utexas.edu!mars.tsd.arlut.utexas.edu!gardner
1993-08-19  2:18 portal!cup.portal.com!R_Tim_Coslet
1993-08-18 16:40 cis.ohio-state.edu!magnus.acs.ohio-state.edu!csn!news.den.mmc.com!iplmail
1993-08-18 16:27 Charles H. Sampson
1993-08-18 16:04 Charles H. Sampson
1993-08-18 12:50 cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!europa.eng.gtefsd.com!fs7.ece.cmu.edu!news.sei.cmu.edu!firth
1993-08-18  2:11 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!agate!do
1993-08-18  1:53 cis.ohio-state.edu!magnus.acs.ohio-state.edu!math.ohio-state.edu!howland.
1993-08-18  0:39 cis.ohio-state.edu!magnus.acs.ohio-state.edu!math.ohio-state.edu!cs.utexa
1993-08-17 15:16 Charles H. Sampson
1993-08-13 17:57 cgl!sgiblab!darwin.sura.net!mlb.semi.harris.com!x102a!scook
1993-08-13 12:48 Bob Gilbert
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox