comp.lang.ada
 help / color / mirror / Atom feed
From: emery@mitre-bedford.arpa  (David Emery)
Subject: Re: Generic Pointer Type
Date: 8 Sep 93 18:36:49 GMT	[thread overview]
Message-ID: <EMERY.93Sep8133649@goldfinger.mitre.org> (raw)

There is no guarantee *within the language* that any unchecked
conversion will have any meaning.  In particular, there are systems
where you *cannot* convert between arbitrary access types in any
meaningful sense.  For instance, access to scalar may be the address
of the object, but access to array may be a structure holding the
first index, length and address of the first element.  In this case,
integer_access'size /= array_access'size.  Another problem can occur
with collections.  An access value may be an offset within a given
collection.  Two access types may define different collections, so
that converting from one to another produces a 'meaningless' value,
because the access values are not addresses, but are offsets within
different collections, and the 'collection address' is NOT stored with
the access value.

That's how Unchecked_Conversion is "outside of the language".  The WG9
Uniformity Rapporteur Group has been studying this problem for quite
some time, and produced some recommendations for Ada83.  Note that
Ada9X addresses part of this problem within the scope of the language.

Anytime you use Unchecked_Conversion, you incur a portability risk.
This doesn't mean "don't do it", but it means that "understand what
you're doing."

				dave

             reply	other threads:[~1993-09-08 18:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-09-08 18:36 David Emery [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-09-09 17:44 Generic Pointer Type Bev in R. Brett
1993-09-09 14:59 Wes Groleau x1240 C73-8
1993-09-08 19:25 cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!progers
1993-09-08 15:51 cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!progers
1993-09-07 19:18 dog.ee.lbl.gov!agate!howland.reston.ans.net!usc!elroy.jpl.nasa.gov!swrind
1993-09-07 15:58 Norman H. Cohen
1993-09-04  0:17 Robert Dewar
replies disabled

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