comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Representation Clauses for tagged types
Date: 1998/08/26
Date: 1998-08-26T00:00:00+00:00	[thread overview]
Message-ID: <6s19hu$f3q@lotho.delphi.com> (raw)

There was a discussion of this recently, as I recall.
My experience with three MS Windows targeted compilers
is that letting the tag occupy the first 32 bits, works.
   for example_t use record
      x at 4 range ....
But there's surely no guarantee.

> Also, another question concerning this is can
> I force the tag to be a certain bit size.
  The compiler and run-time-system need to put certain
info (probably a pointer) into the tag.  If they need
32 bits, you can't just toss out 29 of them.

But are you sure you need to specify the tag representation
at all?  Presumably you aren't reading in a tagged record and
its tag (which depends on the particular compiler, and quite
likely is in fact an address in RAM) from an external device,
or from a non-Ada program or OS.  Similarly, you probably
don't really want to send the tag to the non-Ada program or
an external device.  How about:
  type X_Values is range 0 .. 31;
  type Actual_Record_Type is record
    X : X_Values;
  end record;
  for Actual_Record_Type use record
    X at 0 range 3 .. 7;
  end record;
  type example_t is tagged record
    Content : Actual_Record_Type;
  end record;
Then in your Ada program you have a tagged type example_t, but
for external use you can do IO or whatever on Content, whose
representation you control.




             reply	other threads:[~1998-08-26  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-26  0:00 tmoran [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-08-26  0:00 Representation Clauses for tagged types Courville
1998-08-26  0:00 ` David C. Hoos, Sr.
1998-08-28  0:00 ` Matthew Heaney
replies disabled

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