comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Alternate to Unchecked_Conversion - Portable?
Date: 1999/02/26
Date: 1999-02-26T00:00:00+00:00	[thread overview]
Message-ID: <wcc1zjdxcz6.fsf@world.std.com> (raw)
In-Reply-To: dale-2602991000050001@dale.bu.cs.rmit.edu.au

dale@cs.rmit.edu.au (Dale Stanbrough) writes:

> Why can't we have a routine (it would no doubt have been best
> in  System.Address_To_Access_Conversions) that allows
> for the creation of unconstrained pointers...
> 
> e.g.
> 
>    pointer := to_unconstrained_pointer (some_address, low_bound, upper_bound);

Because we wanted to allow compilers to implement
access-to-unconstrained as a single address, pointing to a chunk of
memory that stores both the dope (bounds, &c) and the data.  Given that
implementation, the above is impossible to implement, because the C
compiler presumably didn't leave room for the dope.

It is possible to implement what you suggest, if you implement these
kinds of pointers as a pair (dope, address of data) or (address of dope,
address of data).  But we didn't want to require that, because it's hard
to implement, and (more importantly) many Ada 83 compilers had already
done it the other way.  The (dope, address of data) scheme is hard to
implement because the compiler doesn't always know the size of the dope
when it needs to allocate a pointer -- in the case where it points to an
incomplete type declared in a private part and completed in the package
body.  In the (address of dope, address of data) scheme, it is
complicated to know where to allocate the dope.  And for the
incomplete-completed-in-body case, you have to assume the worst and
allocate two-word pointers, even though 99% of all pointers point to
records with no dope; that's an annoying waste.

For the same reason, we didn't allow 'Access of a slice, even though
some folks argued rather strongly in favor of that feature.

- Bob
-- 
Change robert to bob to get my real email address.  Sorry.




  reply	other threads:[~1999-02-26  0:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-21  0:00 Alternate to Unchecked_Conversion - Portable? Steve Doiel
1999-02-21  0:00 ` Steve Quinlan
1999-02-22  0:00   ` robert_dewar
1999-02-21  0:00 ` Matthew Heaney
1999-02-22  0:00 ` robert_dewar
1999-02-22  0:00   ` Samuel Mize
1999-02-22  0:00 ` Christopher Green
1999-02-23  0:00   ` Matthew Heaney
1999-02-23  0:00     ` Samuel Mize
1999-02-24  0:00     ` robert_dewar
1999-02-25  0:00       ` Nick Roberts
1999-02-25  0:00         ` robert_dewar
1999-02-26  0:00           ` Nick Roberts
1999-02-26  0:00             ` Matthew Heaney
1999-02-27  0:00               ` Nick Roberts
1999-02-24  0:00   ` robert_dewar
1999-02-23  0:00     ` Christopher Green
1999-02-25  0:00       ` robert_dewar
1999-02-24  0:00         ` Christopher Green
1999-02-25  0:00           ` robert_dewar
1999-02-25  0:00             ` dennison
1999-02-25  0:00               ` Christopher Green
1999-02-26  0:00                 ` robert_dewar
1999-02-26  0:00                   ` Christopher Green
1999-03-01  0:00                     ` Nick Roberts
1999-03-01  0:00                       ` dewar
1999-03-01  0:00                         ` Nick Roberts
1999-02-26  0:00                 ` Tom Moran
1999-02-26  0:00                   ` robert_dewar
1999-02-26  0:00             ` Robert A Duff
1999-02-28  0:00               ` robert_dewar
1999-02-23  0:00     ` Christopher Green
1999-02-25  0:00       ` robert_dewar
1999-02-24  0:00         ` Christopher Green
1999-02-25  0:00           ` robert_dewar
1999-02-26  0:00             ` Dale Stanbrough
1999-02-26  0:00               ` Robert A Duff [this message]
1999-02-22  0:00 ` Tom Moran
replies disabled

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