comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <dewar@gnat.com>
Subject: Re: Tagged Rep Spec
Date: 1999/06/25
Date: 1999-06-25T00:00:00+00:00	[thread overview]
Message-ID: <7l04v5$61p$1@nnrp1.deja.com> (raw)
In-Reply-To: m3btegoyj6.fsf@mheaney.ni.net

In article <m3btegoyj6.fsf@mheaney.ni.net>,
  Matthew Heaney <matthew_heaney@acm.org> wrote:
> On 15 Jun 1999 14:08, jsanchor@cs5.dasd.honeywell.com wrote:
>
> > I was wondering. Can a person Rep Spec a tagged record?
>
> The correct term is rep "clause."
>
> Although the RM allows you to specify a rep clause for a
tagged type, I
> don't see the point, since you don't know
>
>   1) how big the tag is
>
>   2) if the compiler needs the tag to be placed at a specific
>      offset
>
>   3) if there even is a tag


These are not reasons for not specifying a rep clause, they
are just reminders that the rep clause will likely be
impl dependent, but then MANY rep clauses are impl dependent.

The subset of portable rep clauses required by the RM is a
small subset of the useful rep clauses, and in our experience
real life large programs are full of all kinds of rep clauses
outside the set required by the RM.

For example, consider array packing. The RM requires close
packing only for the cases of 1,2,4,8,16 etc bits. That's
very restrictive. In GNAT we allow close packing for any
component size up to 64 bits. That still may not be enough,
we just got a request from a customer to support close packing
for various sizes (136, 255) up to 256 bits.

In the case of tagged types, the tag in GNAT is a single pointer
sized object at offset 0 in the record. Rep clauses can be
freely used to position the specified fields of the type,
providing that the space for the tag is not stomped on.

There are many useful uses of this capability.

Robert Dewar
Ada Core Technologies


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




  reply	other threads:[~1999-06-25  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-15  0:00 Tagged Rep Spec jsanchor
1999-06-15  0:00 ` Tom Moran
1999-06-16  0:00   ` jsanchor
1999-06-15  0:00 ` Marin David Condic
1999-06-16  0:00 ` Matthew Heaney
1999-06-25  0:00   ` Robert Dewar [this message]
1999-06-28  0:00     ` Marin David Condic
replies disabled

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