comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Type conversion between access types (was: Free'ing extended types)
Date: 1996/05/23
Date: 1996-05-23T00:00:00+00:00	[thread overview]
Message-ID: <Drv666.92J@world.std.com> (raw)
In-Reply-To: leschkes.832803959@ferret


In article <leschkes.832803959@ferret>,
Scott Leschke <leschkes@ferret.cig.mot.com> wrote:
>So what about 'all' causes the conversion to be allowed?  I looked at
>section 4.6 of the LRM but got a tad confused?

If you write "all", then it's called a "general access type".  4.6(13)
allows conversion from an access type (general or pool-specific) to a
general access type.  4.6(21) says that if the target type doesn't fall
into one the cases allowed previously, then you can only convert within
the same tree of derived types.  (I suspect that derived access types
are unusual, so that would probably not apply.)

In retrospect, I think the added complexity of "all" was a mistake.  We
should have dropped the "all", and just let 4.6(13) apply to any access
type.

The intention of having the "all" in the language was to allow
implementations to use clever representations for pool-specific access
types.  For example, if you know that the storage pool is only 64 K
bytes, then you can use a 16-bit offset for a pool-specific access type,
because you know it always points into that pool.  For a general access
type, however, you need a full pointer (say, 32 bits), because it can
point into any pool, and can point into the stack.

Another advantage of pool-specific access types is that you know you
can't erroneously deallocate from the wrong storage pool.

But in my programs, I almost always end up writing "all".  I suggest
that you always use "all" for access-to-class-wide types, since you will
often need to do the conversions allowed by 4.6(13).

- Bob




  reply	other threads:[~1996-05-23  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-28  0:00 Free'ing extended types Jonas Nygren
1996-04-28  0:00 ` Robert Dewar
1996-04-29  0:00   ` Laurent Guerby
1996-04-29  0:00     ` Robert A Duff
1996-04-29  0:00       ` Robert Dewar
1996-04-29  0:00   ` Laurent Guerby
1996-04-29  0:00     ` Robert A Duff
1996-04-29  0:00   ` Jonas Nygren
1996-04-29  0:00     ` Robert A Duff
1996-04-29  0:00       ` Jonas Nygren
1996-04-29  0:00       ` Robert Dewar
1996-04-29  0:00         ` Robert A Duff
1996-05-20  0:00       ` Type conversion between access types (was: Free'ing extended types) Scott Leschke
1996-05-21  0:00         ` Dale Stanbrough
1996-05-21  0:00           ` Robert A Duff
1996-05-21  0:00         ` Robert A Duff
1996-05-22  0:00           ` Scott Leschke
1996-05-23  0:00             ` Robert A Duff [this message]
1996-05-23  0:00               ` progers
1996-05-24  0:00               ` Scott Leschke
1996-05-24  0:00                 ` Robert A Duff
replies disabled

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