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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ab36006a122bb868 X-Google-Attributes: gid103376,public From: "Samuel T. Harris" Subject: Re: Overlay allowability Date: 2000/05/03 Message-ID: <3910514D.13BF2DE1@Raytheon.com>#1/1 X-Deja-AN: 618747804 Content-Transfer-Encoding: 7bit References: <390D94FB.D23390D4@lmco.com> <8eketr$i3c$1@nnrp1.deja.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Raytheon Aerospace Engineering Services Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-05-03T00:00:00+00:00 List-Id: Ted Dennison wrote: > > In article <390D94FB.D23390D4@lmco.com>, > "Marc A. Criley" wrote: > > A few times in my career I've encountered situations where two > > different representations of the same set of bits are desired in a > > high > > > This has always struck me as somewhat iffy, but I confess I've used > > it as well on a couple occasions with Ada 83. I've always found that > > it works as one intuitively expects, so long as all alignment, layout > > and sizing aspects are fully thought through and accommodated. > > In Ada 83 I believe doing that rendered your program erronious. In 95, > I'm not sure, but its probably been reassigned to "bounded error" territory. > > This is exactly what Unchecked_Conversion was put in the language for. > If performance prohibits copying the whole structure, you can always > perform unchecked conversion on an access type that points to your > structure (even SMART allowed this). > Many times the need for such overlays is a continual need throughout a section of code. Several calls to unchecked_conversion is simply to slow and does present a consistency problem associated with having two separate objects instead of two overlayed objects. This consistency problem can be exploited in a tasking environment and cause unpredictable results. So, when performance and consistency are the requirements, make an overlay. If one simply needs to jam one kind of data into another, use unchecked_conversion. -- Samuel T. Harris, Principal Engineer Raytheon, Aerospace Engineering Services "If you can make it, We can fake it!"