comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: Tagged Rep Spec
Date: 1999/06/16
Date: 1999-06-16T00:00:00+00:00	[thread overview]
Message-ID: <m3btegoyj6.fsf@mheaney.ni.net> (raw)
In-Reply-To: 7k5mop$n0i$1@nnrp1.deja.com

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


If you need to transmit this data across an external interface, then use
the streams facility.  That way you won't have to go mucking around with
non-portable, ill-defined rep clauses.

If you don't need type extension for this abstraction, then don't bother
making the type tagged.  Not every type needs to be a tagged type.

 
> Type  Interrupt_Record_Type is tagged
>    Record
>      watchdog_warning   : boolean;
>      utility_clock               : boolean;
>      timer1                        :boolean;
>      rs232                         :boolean;
>      mailbox                      :boolean;
>    end record;
> 
> for Interrupt_Record_Type use
>    record
>      watchdog_warning   at 0 range 0..0;
>      utility_clock               at 0 range 1..1;
>      timer1                        at 0 range 2..2;
>      rs232                         at 0 range 3..3;
>      mailbox                      at 0 range 4..4;
>    end record;


This looks like it doesn't need to be tagged, as it seems low-level.






  parent reply	other threads:[~1999-06-16  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 [this message]
1999-06-25  0:00   ` Robert Dewar
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